Seed a hinted and an unhinted code block
The dev server now shows both highlighting paths: a Rust block marked by its source, and a Python block left to detection. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+19
-3
@@ -131,9 +131,25 @@ fn body_html(title: &str, words: i64) -> String {
|
||||
html.push_str("<blockquote><p>A pull quote that the author would rather you remembered than the rest.</p></blockquote>");
|
||||
}
|
||||
if index == 7 {
|
||||
html.push_str(
|
||||
"<pre><code>fn main() {\n println!(\"hello, reader\");\n}</code></pre>",
|
||||
);
|
||||
// One block the source marked as Rust, one it left for detection.
|
||||
html.push_str(concat!(
|
||||
"<pre data-lang=\"rust\"><code>/// Greets whoever is reading.\n",
|
||||
"fn main() {\n",
|
||||
" let reader: &str = \"reader\";\n",
|
||||
" for n in 0..3 {\n",
|
||||
" println!(\"hello, {reader} #{n}\"); // three times\n",
|
||||
" }\n",
|
||||
"}</code></pre>",
|
||||
"<pre><code>import json\n\n",
|
||||
"def load(path: str) -> dict:\n",
|
||||
" \"\"\"Read a JSON config, or an empty one.\"\"\"\n",
|
||||
" try:\n",
|
||||
" with open(path) as f:\n",
|
||||
" return json.load(f)\n",
|
||||
" except FileNotFoundError:\n",
|
||||
" return {} # first run\n",
|
||||
"</code></pre>",
|
||||
));
|
||||
}
|
||||
html.push_str("<p>Paragraph ");
|
||||
html.push_str(&(index + 1).to_string());
|
||||
|
||||
Reference in New Issue
Block a user