Put the "syntect" class on the code

This way, playground buttons don't scroll along with the code.
This commit is contained in:
Michael Howell 2021-09-18 17:14:54 -07:00
parent 0dd350d3d1
commit 129b56012c
3 changed files with 31 additions and 30 deletions

View File

@ -190,9 +190,10 @@ blockquote {
font-style: italic; font-style: italic;
} }
pre.syntect { code.syntect {
color: var(--syntect-fg); color: var(--syntect-fg);
background: var(--syntect-bg); background: var(--syntect-bg);
padding: 0.5em; padding: 0.5em;
overflow-y: auto; overflow-y: auto;
display: block;
} }

View File

@ -338,7 +338,7 @@ impl<'a> SyntaxHighlighter<'a> {
} }
self.is_playground = true; self.is_playground = true;
return Event::Html(CowStr::from(format!( return Event::Html(CowStr::from(format!(
r#"<pre class="syntect playground"><code class="language-{}">"#, r#"<pre class="playground"><code class="syntect language-{}">"#,
classes.join(" ") classes.join(" ")
))); )));
} else { } else {
@ -355,7 +355,7 @@ impl<'a> SyntaxHighlighter<'a> {
Event::Html(CowStr::from("<pre><code>")) Event::Html(CowStr::from("<pre><code>"))
} else { } else {
Event::Html(CowStr::from(format!( Event::Html(CowStr::from(format!(
r#"<pre class="syntect"><code class="language-{}">"#, r#"<pre><code class="syntect language-{}">"#,
classes.join(" ") classes.join(" ")
))) )))
} }
@ -578,7 +578,7 @@ more text with spaces
"#; "#;
let expected = r#"<p>some text with spaces</p> let expected = r#"<p>some text with spaces</p>
<pre class="syntect playground"><code class="language-rust"><span class="syn-source syn-rust"><span class="syn-meta syn-function syn-rust"><span class="syn-meta syn-function syn-rust"><span class="syn-storage syn-type syn-function syn-rust">fn</span> </span><span class="syn-entity syn-name syn-function syn-rust">main</span></span><span class="syn-meta syn-function syn-rust"><span class="syn-meta syn-function syn-parameters syn-rust"><span class="syn-punctuation syn-section syn-parameters syn-begin syn-rust">(</span></span><span class="syn-meta syn-function syn-rust"><span class="syn-meta syn-function syn-parameters syn-rust"><span class="syn-punctuation syn-section syn-parameters syn-end syn-rust">)</span></span></span></span><span class="syn-meta syn-function syn-rust"> </span><span class="syn-meta syn-function syn-rust"><span class="syn-meta syn-block syn-rust"><span class="syn-punctuation syn-section syn-block syn-begin syn-rust">{</span> <pre class="playground"><code class="syntect language-rust"><span class="syn-source syn-rust"><span class="syn-meta syn-function syn-rust"><span class="syn-meta syn-function syn-rust"><span class="syn-storage syn-type syn-function syn-rust">fn</span> </span><span class="syn-entity syn-name syn-function syn-rust">main</span></span><span class="syn-meta syn-function syn-rust"><span class="syn-meta syn-function syn-parameters syn-rust"><span class="syn-punctuation syn-section syn-parameters syn-begin syn-rust">(</span></span><span class="syn-meta syn-function syn-rust"><span class="syn-meta syn-function syn-parameters syn-rust"><span class="syn-punctuation syn-section syn-parameters syn-end syn-rust">)</span></span></span></span><span class="syn-meta syn-function syn-rust"> </span><span class="syn-meta syn-function syn-rust"><span class="syn-meta syn-block syn-rust"><span class="syn-punctuation syn-section syn-block syn-begin syn-rust">{</span>
<span class="syn-comment syn-line syn-double-slash syn-rust"><span class="syn-punctuation syn-definition syn-comment syn-rust">//</span> code inside is unchanged <span class="syn-comment syn-line syn-double-slash syn-rust"><span class="syn-punctuation syn-definition syn-comment syn-rust">//</span> code inside is unchanged
</span></span><span class="syn-meta syn-block syn-rust"><span class="syn-punctuation syn-section syn-block syn-end syn-rust">}</span></span></span> </span></span><span class="syn-meta syn-block syn-rust"><span class="syn-punctuation syn-section syn-block syn-end syn-rust">}</span></span></span>
</span></code></pre> </span></code></pre>
@ -613,7 +613,7 @@ more text with spaces
``` ```
"#; "#;
let expected = r#"<pre class="syntect playground"><code class="language-rust no_run should_panic property_3"></code></pre>"#; let expected = r#"<pre class="playground"><code class="syntect language-rust no_run should_panic property_3"></code></pre>"#;
assert_eq!( assert_eq!(
render_markdown( render_markdown(
input, input,
@ -643,7 +643,7 @@ more text with spaces
``` ```
"#; "#;
let expected = r#"<pre class="syntect playground"><code class="language-rust no_run should_panic property_3"></code></pre>"#; let expected = r#"<pre class="playground"><code class="syntect language-rust no_run should_panic property_3"></code></pre>"#;
assert_eq!( assert_eq!(
render_markdown( render_markdown(
input, input,
@ -674,7 +674,7 @@ more text with spaces
"#; "#;
let expected = let expected =
r#"<pre class="syntect playground"><code class="language-rust"></code></pre>"#; r#"<pre class="playground"><code class="syntect language-rust"></code></pre>"#;
assert_eq!( assert_eq!(
render_markdown( render_markdown(
input, input,
@ -705,19 +705,19 @@ more text with spaces
fn add_playground() { fn add_playground() {
let inputs = [ let inputs = [
("```rust\nx()\n```", ("```rust\nx()\n```",
"<pre class=\"syntect playground\"><code class=\"language-rust\"><span class=\"boring\"><span class=\"syn-source syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-storage syn-type syn-function syn-rust\">fn</span> </span><span class=\"syn-entity syn-name syn-function syn-rust\">main</span></span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-parameters syn-rust\"><span class=\"syn-punctuation syn-section syn-parameters syn-begin syn-rust\">(</span></span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-parameters syn-rust\"><span class=\"syn-punctuation syn-section syn-parameters syn-end syn-rust\">)</span></span></span></span><span class=\"syn-meta syn-function syn-rust\"> </span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-block syn-rust\"><span class=\"syn-punctuation syn-section syn-block syn-begin syn-rust\">{</span>\n</span></span></span></span><span class=\"syn-source syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-block syn-rust\"><span class=\"syn-support syn-function syn-rust\">x</span><span class=\"syn-meta syn-group syn-rust\"><span class=\"syn-punctuation syn-section syn-group syn-begin syn-rust\">(</span></span><span class=\"syn-meta syn-group syn-rust\"><span class=\"syn-punctuation syn-section syn-group syn-end syn-rust\">)</span></span>\n</span></span></span><span class=\"boring\"><span class=\"syn-source syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-block syn-rust\"><span class=\"syn-punctuation syn-section syn-block syn-end syn-rust\">}</span></span></span>\n</span></span></code></pre>"), "<pre class=\"playground\"><code class=\"syntect language-rust\"><span class=\"boring\"><span class=\"syn-source syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-storage syn-type syn-function syn-rust\">fn</span> </span><span class=\"syn-entity syn-name syn-function syn-rust\">main</span></span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-parameters syn-rust\"><span class=\"syn-punctuation syn-section syn-parameters syn-begin syn-rust\">(</span></span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-parameters syn-rust\"><span class=\"syn-punctuation syn-section syn-parameters syn-end syn-rust\">)</span></span></span></span><span class=\"syn-meta syn-function syn-rust\"> </span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-block syn-rust\"><span class=\"syn-punctuation syn-section syn-block syn-begin syn-rust\">{</span>\n</span></span></span></span><span class=\"syn-source syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-block syn-rust\"><span class=\"syn-support syn-function syn-rust\">x</span><span class=\"syn-meta syn-group syn-rust\"><span class=\"syn-punctuation syn-section syn-group syn-begin syn-rust\">(</span></span><span class=\"syn-meta syn-group syn-rust\"><span class=\"syn-punctuation syn-section syn-group syn-end syn-rust\">)</span></span>\n</span></span></span><span class=\"boring\"><span class=\"syn-source syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-block syn-rust\"><span class=\"syn-punctuation syn-section syn-block syn-end syn-rust\">}</span></span></span>\n</span></span></code></pre>"),
("```rust\nfn main() {}\n```", ("```rust\nfn main() {}\n```",
"<pre class=\"syntect playground\"><code class=\"language-rust\"><span class=\"syn-source syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-storage syn-type syn-function syn-rust\">fn</span> </span><span class=\"syn-entity syn-name syn-function syn-rust\">main</span></span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-parameters syn-rust\"><span class=\"syn-punctuation syn-section syn-parameters syn-begin syn-rust\">(</span></span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-parameters syn-rust\"><span class=\"syn-punctuation syn-section syn-parameters syn-end syn-rust\">)</span></span></span></span><span class=\"syn-meta syn-function syn-rust\"> </span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-block syn-rust\"><span class=\"syn-punctuation syn-section syn-block syn-begin syn-rust\">{</span></span><span class=\"syn-meta syn-block syn-rust\"><span class=\"syn-punctuation syn-section syn-block syn-end syn-rust\">}</span></span></span>\n</span></code></pre>"), "<pre class=\"playground\"><code class=\"syntect language-rust\"><span class=\"syn-source syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-storage syn-type syn-function syn-rust\">fn</span> </span><span class=\"syn-entity syn-name syn-function syn-rust\">main</span></span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-parameters syn-rust\"><span class=\"syn-punctuation syn-section syn-parameters syn-begin syn-rust\">(</span></span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-parameters syn-rust\"><span class=\"syn-punctuation syn-section syn-parameters syn-end syn-rust\">)</span></span></span></span><span class=\"syn-meta syn-function syn-rust\"> </span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-block syn-rust\"><span class=\"syn-punctuation syn-section syn-block syn-begin syn-rust\">{</span></span><span class=\"syn-meta syn-block syn-rust\"><span class=\"syn-punctuation syn-section syn-block syn-end syn-rust\">}</span></span></span>\n</span></code></pre>"),
("```rust editable\nlet s = \"foo\n # bar\n\";\n```", ("```rust editable\nlet s = \"foo\n # bar\n\";\n```",
"<pre class=\"syntect playground\"><code class=\"language-rust editable\"><span class=\"syn-source syn-rust\"><span class=\"syn-storage syn-type syn-rust\">let</span> s <span class=\"syn-keyword syn-operator syn-rust\">=</span> <span class=\"syn-string syn-quoted syn-double syn-rust\"><span class=\"syn-punctuation syn-definition syn-string syn-begin syn-rust\">&quot;</span>foo\n</span></span><span class=\"boring\"><span class=\"syn-source syn-rust\"><span class=\"syn-string syn-quoted syn-double syn-rust\"> bar\n</span></span></span><span class=\"syn-source syn-rust\"><span class=\"syn-string syn-quoted syn-double syn-rust\"><span class=\"syn-punctuation syn-definition syn-string syn-end syn-rust\">&quot;</span></span><span class=\"syn-punctuation syn-terminator syn-rust\">;</span>\n</span></code></pre>"), "<pre class=\"playground\"><code class=\"syntect language-rust editable\"><span class=\"syn-source syn-rust\"><span class=\"syn-storage syn-type syn-rust\">let</span> s <span class=\"syn-keyword syn-operator syn-rust\">=</span> <span class=\"syn-string syn-quoted syn-double syn-rust\"><span class=\"syn-punctuation syn-definition syn-string syn-begin syn-rust\">&quot;</span>foo\n</span></span><span class=\"boring\"><span class=\"syn-source syn-rust\"><span class=\"syn-string syn-quoted syn-double syn-rust\"> bar\n</span></span></span><span class=\"syn-source syn-rust\"><span class=\"syn-string syn-quoted syn-double syn-rust\"><span class=\"syn-punctuation syn-definition syn-string syn-end syn-rust\">&quot;</span></span><span class=\"syn-punctuation syn-terminator syn-rust\">;</span>\n</span></code></pre>"),
("```rust editable\nlet s = \"foo\n ## bar\n\";\n```", ("```rust editable\nlet s = \"foo\n ## bar\n\";\n```",
"<pre class=\"syntect playground\"><code class=\"language-rust editable\"><span class=\"syn-source syn-rust\"><span class=\"syn-storage syn-type syn-rust\">let</span> s <span class=\"syn-keyword syn-operator syn-rust\">=</span> <span class=\"syn-string syn-quoted syn-double syn-rust\"><span class=\"syn-punctuation syn-definition syn-string syn-begin syn-rust\">&quot;</span>foo\n</span></span><span class=\"boring\"><span class=\"syn-source syn-rust\"><span class=\"syn-string syn-quoted syn-double syn-rust\"> # bar\n</span></span></span><span class=\"syn-source syn-rust\"><span class=\"syn-string syn-quoted syn-double syn-rust\"><span class=\"syn-punctuation syn-definition syn-string syn-end syn-rust\">&quot;</span></span><span class=\"syn-punctuation syn-terminator syn-rust\">;</span>\n</span></code></pre>"), "<pre class=\"playground\"><code class=\"syntect language-rust editable\"><span class=\"syn-source syn-rust\"><span class=\"syn-storage syn-type syn-rust\">let</span> s <span class=\"syn-keyword syn-operator syn-rust\">=</span> <span class=\"syn-string syn-quoted syn-double syn-rust\"><span class=\"syn-punctuation syn-definition syn-string syn-begin syn-rust\">&quot;</span>foo\n</span></span><span class=\"boring\"><span class=\"syn-source syn-rust\"><span class=\"syn-string syn-quoted syn-double syn-rust\"> # bar\n</span></span></span><span class=\"syn-source syn-rust\"><span class=\"syn-string syn-quoted syn-double syn-rust\"><span class=\"syn-punctuation syn-definition syn-string syn-end syn-rust\">&quot;</span></span><span class=\"syn-punctuation syn-terminator syn-rust\">;</span>\n</span></code></pre>"),
("```rust editable\nlet s = \"foo\n # bar\n#\n\";\n```", ("```rust editable\nlet s = \"foo\n # bar\n#\n\";\n```",
"<pre class=\"syntect playground\"><code class=\"language-rust editable\"><span class=\"syn-source syn-rust\"><span class=\"syn-storage syn-type syn-rust\">let</span> s <span class=\"syn-keyword syn-operator syn-rust\">=</span> <span class=\"syn-string syn-quoted syn-double syn-rust\"><span class=\"syn-punctuation syn-definition syn-string syn-begin syn-rust\">&quot;</span>foo\n</span></span><span class=\"boring\"><span class=\"syn-source syn-rust\"><span class=\"syn-string syn-quoted syn-double syn-rust\"> bar\n\n</span></span></span><span class=\"syn-source syn-rust\"><span class=\"syn-string syn-quoted syn-double syn-rust\"><span class=\"syn-punctuation syn-definition syn-string syn-end syn-rust\">&quot;</span></span><span class=\"syn-punctuation syn-terminator syn-rust\">;</span>\n</span></code></pre>"), "<pre class=\"playground\"><code class=\"syntect language-rust editable\"><span class=\"syn-source syn-rust\"><span class=\"syn-storage syn-type syn-rust\">let</span> s <span class=\"syn-keyword syn-operator syn-rust\">=</span> <span class=\"syn-string syn-quoted syn-double syn-rust\"><span class=\"syn-punctuation syn-definition syn-string syn-begin syn-rust\">&quot;</span>foo\n</span></span><span class=\"boring\"><span class=\"syn-source syn-rust\"><span class=\"syn-string syn-quoted syn-double syn-rust\"> bar\n\n</span></span></span><span class=\"syn-source syn-rust\"><span class=\"syn-string syn-quoted syn-double syn-rust\"><span class=\"syn-punctuation syn-definition syn-string syn-end syn-rust\">&quot;</span></span><span class=\"syn-punctuation syn-terminator syn-rust\">;</span>\n</span></code></pre>"),
("```rust ignore\nlet s = \"foo\n # bar\n\";\n```", ("```rust ignore\nlet s = \"foo\n # bar\n\";\n```",
"<pre class=\"syntect\"><code class=\"language-rust ignore\"><span class=\"syn-source syn-rust\"><span class=\"syn-storage syn-type syn-rust\">let</span> s <span class=\"syn-keyword syn-operator syn-rust\">=</span> <span class=\"syn-string syn-quoted syn-double syn-rust\"><span class=\"syn-punctuation syn-definition syn-string syn-begin syn-rust\">&quot;</span>foo\n</span></span><span class=\"boring\"><span class=\"syn-source syn-rust\"><span class=\"syn-string syn-quoted syn-double syn-rust\"> bar\n</span></span></span><span class=\"syn-source syn-rust\"><span class=\"syn-string syn-quoted syn-double syn-rust\"><span class=\"syn-punctuation syn-definition syn-string syn-end syn-rust\">&quot;</span></span><span class=\"syn-punctuation syn-terminator syn-rust\">;</span>\n</span></code></pre>"), "<pre><code class=\"syntect language-rust ignore\"><span class=\"syn-source syn-rust\"><span class=\"syn-storage syn-type syn-rust\">let</span> s <span class=\"syn-keyword syn-operator syn-rust\">=</span> <span class=\"syn-string syn-quoted syn-double syn-rust\"><span class=\"syn-punctuation syn-definition syn-string syn-begin syn-rust\">&quot;</span>foo\n</span></span><span class=\"boring\"><span class=\"syn-source syn-rust\"><span class=\"syn-string syn-quoted syn-double syn-rust\"> bar\n</span></span></span><span class=\"syn-source syn-rust\"><span class=\"syn-string syn-quoted syn-double syn-rust\"><span class=\"syn-punctuation syn-definition syn-string syn-end syn-rust\">&quot;</span></span><span class=\"syn-punctuation syn-terminator syn-rust\">;</span>\n</span></code></pre>"),
("```rust editable\n#![no_std]\nlet s = \"foo\";\n #[some_attr]\n```", ("```rust editable\n#![no_std]\nlet s = \"foo\";\n #[some_attr]\n```",
"<pre class=\"syntect playground\"><code class=\"language-rust editable\"><span class=\"syn-source syn-rust\"><span class=\"syn-meta syn-annotation syn-rust\"><span class=\"syn-punctuation syn-definition syn-annotation syn-rust\">#!</span><span class=\"syn-punctuation syn-section syn-group syn-begin syn-rust\">[</span><span class=\"syn-variable syn-annotation syn-rust\">no_std</span><span class=\"syn-punctuation syn-section syn-group syn-end syn-rust\">]</span></span>\n<span class=\"syn-storage syn-type syn-rust\">let</span> s <span class=\"syn-keyword syn-operator syn-rust\">=</span> <span class=\"syn-string syn-quoted syn-double syn-rust\"><span class=\"syn-punctuation syn-definition syn-string syn-begin syn-rust\">&quot;</span>foo<span class=\"syn-punctuation syn-definition syn-string syn-end syn-rust\">&quot;</span></span><span class=\"syn-punctuation syn-terminator syn-rust\">;</span>\n <span class=\"syn-meta syn-annotation syn-rust\"><span class=\"syn-punctuation syn-definition syn-annotation syn-rust\">#</span><span class=\"syn-punctuation syn-section syn-group syn-begin syn-rust\">[</span><span class=\"syn-variable syn-annotation syn-rust\">some_attr</span><span class=\"syn-punctuation syn-section syn-group syn-end syn-rust\">]</span></span>\n</span></code></pre>"), "<pre class=\"playground\"><code class=\"syntect language-rust editable\"><span class=\"syn-source syn-rust\"><span class=\"syn-meta syn-annotation syn-rust\"><span class=\"syn-punctuation syn-definition syn-annotation syn-rust\">#!</span><span class=\"syn-punctuation syn-section syn-group syn-begin syn-rust\">[</span><span class=\"syn-variable syn-annotation syn-rust\">no_std</span><span class=\"syn-punctuation syn-section syn-group syn-end syn-rust\">]</span></span>\n<span class=\"syn-storage syn-type syn-rust\">let</span> s <span class=\"syn-keyword syn-operator syn-rust\">=</span> <span class=\"syn-string syn-quoted syn-double syn-rust\"><span class=\"syn-punctuation syn-definition syn-string syn-begin syn-rust\">&quot;</span>foo<span class=\"syn-punctuation syn-definition syn-string syn-end syn-rust\">&quot;</span></span><span class=\"syn-punctuation syn-terminator syn-rust\">;</span>\n <span class=\"syn-meta syn-annotation syn-rust\"><span class=\"syn-punctuation syn-definition syn-annotation syn-rust\">#</span><span class=\"syn-punctuation syn-section syn-group syn-begin syn-rust\">[</span><span class=\"syn-variable syn-annotation syn-rust\">some_attr</span><span class=\"syn-punctuation syn-section syn-group syn-end syn-rust\">]</span></span>\n</span></code></pre>"),
]; ];
for (src, should_be) in &inputs { for (src, should_be) in &inputs {
let got = render_markdown( let got = render_markdown(
@ -737,13 +737,13 @@ more text with spaces
fn add_playground_edition2015() { fn add_playground_edition2015() {
let inputs = [ let inputs = [
("```rust\nx()\n```", ("```rust\nx()\n```",
"<pre class=\"syntect playground\"><code class=\"language-rust edition2015\"><span class=\"boring\"><span class=\"syn-source syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-storage syn-type syn-function syn-rust\">fn</span> </span><span class=\"syn-entity syn-name syn-function syn-rust\">main</span></span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-parameters syn-rust\"><span class=\"syn-punctuation syn-section syn-parameters syn-begin syn-rust\">(</span></span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-parameters syn-rust\"><span class=\"syn-punctuation syn-section syn-parameters syn-end syn-rust\">)</span></span></span></span><span class=\"syn-meta syn-function syn-rust\"> </span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-block syn-rust\"><span class=\"syn-punctuation syn-section syn-block syn-begin syn-rust\">{</span>\n</span></span></span></span><span class=\"syn-source syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-block syn-rust\"><span class=\"syn-support syn-function syn-rust\">x</span><span class=\"syn-meta syn-group syn-rust\"><span class=\"syn-punctuation syn-section syn-group syn-begin syn-rust\">(</span></span><span class=\"syn-meta syn-group syn-rust\"><span class=\"syn-punctuation syn-section syn-group syn-end syn-rust\">)</span></span>\n</span></span></span><span class=\"boring\"><span class=\"syn-source syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-block syn-rust\"><span class=\"syn-punctuation syn-section syn-block syn-end syn-rust\">}</span></span></span>\n</span></span></code></pre>"), "<pre class=\"playground\"><code class=\"syntect language-rust edition2015\"><span class=\"boring\"><span class=\"syn-source syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-storage syn-type syn-function syn-rust\">fn</span> </span><span class=\"syn-entity syn-name syn-function syn-rust\">main</span></span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-parameters syn-rust\"><span class=\"syn-punctuation syn-section syn-parameters syn-begin syn-rust\">(</span></span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-parameters syn-rust\"><span class=\"syn-punctuation syn-section syn-parameters syn-end syn-rust\">)</span></span></span></span><span class=\"syn-meta syn-function syn-rust\"> </span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-block syn-rust\"><span class=\"syn-punctuation syn-section syn-block syn-begin syn-rust\">{</span>\n</span></span></span></span><span class=\"syn-source syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-block syn-rust\"><span class=\"syn-support syn-function syn-rust\">x</span><span class=\"syn-meta syn-group syn-rust\"><span class=\"syn-punctuation syn-section syn-group syn-begin syn-rust\">(</span></span><span class=\"syn-meta syn-group syn-rust\"><span class=\"syn-punctuation syn-section syn-group syn-end syn-rust\">)</span></span>\n</span></span></span><span class=\"boring\"><span class=\"syn-source syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-block syn-rust\"><span class=\"syn-punctuation syn-section syn-block syn-end syn-rust\">}</span></span></span>\n</span></span></code></pre>"),
("```rust\nfn main() {}\n```", ("```rust\nfn main() {}\n```",
"<pre class=\"syntect playground\"><code class=\"language-rust edition2015\"><span class=\"syn-source syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-storage syn-type syn-function syn-rust\">fn</span> </span><span class=\"syn-entity syn-name syn-function syn-rust\">main</span></span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-parameters syn-rust\"><span class=\"syn-punctuation syn-section syn-parameters syn-begin syn-rust\">(</span></span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-parameters syn-rust\"><span class=\"syn-punctuation syn-section syn-parameters syn-end syn-rust\">)</span></span></span></span><span class=\"syn-meta syn-function syn-rust\"> </span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-block syn-rust\"><span class=\"syn-punctuation syn-section syn-block syn-begin syn-rust\">{</span></span><span class=\"syn-meta syn-block syn-rust\"><span class=\"syn-punctuation syn-section syn-block syn-end syn-rust\">}</span></span></span>\n</span></code></pre>"), "<pre class=\"playground\"><code class=\"syntect language-rust edition2015\"><span class=\"syn-source syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-storage syn-type syn-function syn-rust\">fn</span> </span><span class=\"syn-entity syn-name syn-function syn-rust\">main</span></span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-parameters syn-rust\"><span class=\"syn-punctuation syn-section syn-parameters syn-begin syn-rust\">(</span></span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-parameters syn-rust\"><span class=\"syn-punctuation syn-section syn-parameters syn-end syn-rust\">)</span></span></span></span><span class=\"syn-meta syn-function syn-rust\"> </span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-block syn-rust\"><span class=\"syn-punctuation syn-section syn-block syn-begin syn-rust\">{</span></span><span class=\"syn-meta syn-block syn-rust\"><span class=\"syn-punctuation syn-section syn-block syn-end syn-rust\">}</span></span></span>\n</span></code></pre>"),
("```rust edition2015\nfn main() {}\n```", ("```rust edition2015\nfn main() {}\n```",
"<pre class=\"syntect playground\"><code class=\"language-rust edition2015\"><span class=\"syn-source syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-storage syn-type syn-function syn-rust\">fn</span> </span><span class=\"syn-entity syn-name syn-function syn-rust\">main</span></span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-parameters syn-rust\"><span class=\"syn-punctuation syn-section syn-parameters syn-begin syn-rust\">(</span></span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-parameters syn-rust\"><span class=\"syn-punctuation syn-section syn-parameters syn-end syn-rust\">)</span></span></span></span><span class=\"syn-meta syn-function syn-rust\"> </span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-block syn-rust\"><span class=\"syn-punctuation syn-section syn-block syn-begin syn-rust\">{</span></span><span class=\"syn-meta syn-block syn-rust\"><span class=\"syn-punctuation syn-section syn-block syn-end syn-rust\">}</span></span></span>\n</span></code></pre>"), "<pre class=\"playground\"><code class=\"syntect language-rust edition2015\"><span class=\"syn-source syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-storage syn-type syn-function syn-rust\">fn</span> </span><span class=\"syn-entity syn-name syn-function syn-rust\">main</span></span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-parameters syn-rust\"><span class=\"syn-punctuation syn-section syn-parameters syn-begin syn-rust\">(</span></span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-parameters syn-rust\"><span class=\"syn-punctuation syn-section syn-parameters syn-end syn-rust\">)</span></span></span></span><span class=\"syn-meta syn-function syn-rust\"> </span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-block syn-rust\"><span class=\"syn-punctuation syn-section syn-block syn-begin syn-rust\">{</span></span><span class=\"syn-meta syn-block syn-rust\"><span class=\"syn-punctuation syn-section syn-block syn-end syn-rust\">}</span></span></span>\n</span></code></pre>"),
("```rust edition2018\nfn main() {}\n```", ("```rust edition2018\nfn main() {}\n```",
"<pre class=\"syntect playground\"><code class=\"language-rust edition2018\"><span class=\"syn-source syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-storage syn-type syn-function syn-rust\">fn</span> </span><span class=\"syn-entity syn-name syn-function syn-rust\">main</span></span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-parameters syn-rust\"><span class=\"syn-punctuation syn-section syn-parameters syn-begin syn-rust\">(</span></span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-parameters syn-rust\"><span class=\"syn-punctuation syn-section syn-parameters syn-end syn-rust\">)</span></span></span></span><span class=\"syn-meta syn-function syn-rust\"> </span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-block syn-rust\"><span class=\"syn-punctuation syn-section syn-block syn-begin syn-rust\">{</span></span><span class=\"syn-meta syn-block syn-rust\"><span class=\"syn-punctuation syn-section syn-block syn-end syn-rust\">}</span></span></span>\n</span></code></pre>"), "<pre class=\"playground\"><code class=\"syntect language-rust edition2018\"><span class=\"syn-source syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-storage syn-type syn-function syn-rust\">fn</span> </span><span class=\"syn-entity syn-name syn-function syn-rust\">main</span></span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-parameters syn-rust\"><span class=\"syn-punctuation syn-section syn-parameters syn-begin syn-rust\">(</span></span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-parameters syn-rust\"><span class=\"syn-punctuation syn-section syn-parameters syn-end syn-rust\">)</span></span></span></span><span class=\"syn-meta syn-function syn-rust\"> </span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-block syn-rust\"><span class=\"syn-punctuation syn-section syn-block syn-begin syn-rust\">{</span></span><span class=\"syn-meta syn-block syn-rust\"><span class=\"syn-punctuation syn-section syn-block syn-end syn-rust\">}</span></span></span>\n</span></code></pre>"),
]; ];
for (src, should_be) in &inputs { for (src, should_be) in &inputs {
let got = render_markdown( let got = render_markdown(
@ -763,13 +763,13 @@ more text with spaces
fn add_playground_edition2018() { fn add_playground_edition2018() {
let inputs = [ let inputs = [
("```rust\nx()\n```", ("```rust\nx()\n```",
"<pre class=\"syntect playground\"><code class=\"language-rust edition2018\"><span class=\"boring\"><span class=\"syn-source syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-storage syn-type syn-function syn-rust\">fn</span> </span><span class=\"syn-entity syn-name syn-function syn-rust\">main</span></span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-parameters syn-rust\"><span class=\"syn-punctuation syn-section syn-parameters syn-begin syn-rust\">(</span></span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-parameters syn-rust\"><span class=\"syn-punctuation syn-section syn-parameters syn-end syn-rust\">)</span></span></span></span><span class=\"syn-meta syn-function syn-rust\"> </span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-block syn-rust\"><span class=\"syn-punctuation syn-section syn-block syn-begin syn-rust\">{</span>\n</span></span></span></span><span class=\"syn-source syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-block syn-rust\"><span class=\"syn-support syn-function syn-rust\">x</span><span class=\"syn-meta syn-group syn-rust\"><span class=\"syn-punctuation syn-section syn-group syn-begin syn-rust\">(</span></span><span class=\"syn-meta syn-group syn-rust\"><span class=\"syn-punctuation syn-section syn-group syn-end syn-rust\">)</span></span>\n</span></span></span><span class=\"boring\"><span class=\"syn-source syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-block syn-rust\"><span class=\"syn-punctuation syn-section syn-block syn-end syn-rust\">}</span></span></span>\n</span></span></code></pre>"), "<pre class=\"playground\"><code class=\"syntect language-rust edition2018\"><span class=\"boring\"><span class=\"syn-source syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-storage syn-type syn-function syn-rust\">fn</span> </span><span class=\"syn-entity syn-name syn-function syn-rust\">main</span></span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-parameters syn-rust\"><span class=\"syn-punctuation syn-section syn-parameters syn-begin syn-rust\">(</span></span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-parameters syn-rust\"><span class=\"syn-punctuation syn-section syn-parameters syn-end syn-rust\">)</span></span></span></span><span class=\"syn-meta syn-function syn-rust\"> </span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-block syn-rust\"><span class=\"syn-punctuation syn-section syn-block syn-begin syn-rust\">{</span>\n</span></span></span></span><span class=\"syn-source syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-block syn-rust\"><span class=\"syn-support syn-function syn-rust\">x</span><span class=\"syn-meta syn-group syn-rust\"><span class=\"syn-punctuation syn-section syn-group syn-begin syn-rust\">(</span></span><span class=\"syn-meta syn-group syn-rust\"><span class=\"syn-punctuation syn-section syn-group syn-end syn-rust\">)</span></span>\n</span></span></span><span class=\"boring\"><span class=\"syn-source syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-block syn-rust\"><span class=\"syn-punctuation syn-section syn-block syn-end syn-rust\">}</span></span></span>\n</span></span></code></pre>"),
("```rust\nfn main() {}\n```", ("```rust\nfn main() {}\n```",
"<pre class=\"syntect playground\"><code class=\"language-rust edition2018\"><span class=\"syn-source syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-storage syn-type syn-function syn-rust\">fn</span> </span><span class=\"syn-entity syn-name syn-function syn-rust\">main</span></span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-parameters syn-rust\"><span class=\"syn-punctuation syn-section syn-parameters syn-begin syn-rust\">(</span></span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-parameters syn-rust\"><span class=\"syn-punctuation syn-section syn-parameters syn-end syn-rust\">)</span></span></span></span><span class=\"syn-meta syn-function syn-rust\"> </span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-block syn-rust\"><span class=\"syn-punctuation syn-section syn-block syn-begin syn-rust\">{</span></span><span class=\"syn-meta syn-block syn-rust\"><span class=\"syn-punctuation syn-section syn-block syn-end syn-rust\">}</span></span></span>\n</span></code></pre>"), "<pre class=\"playground\"><code class=\"syntect language-rust edition2018\"><span class=\"syn-source syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-storage syn-type syn-function syn-rust\">fn</span> </span><span class=\"syn-entity syn-name syn-function syn-rust\">main</span></span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-parameters syn-rust\"><span class=\"syn-punctuation syn-section syn-parameters syn-begin syn-rust\">(</span></span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-parameters syn-rust\"><span class=\"syn-punctuation syn-section syn-parameters syn-end syn-rust\">)</span></span></span></span><span class=\"syn-meta syn-function syn-rust\"> </span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-block syn-rust\"><span class=\"syn-punctuation syn-section syn-block syn-begin syn-rust\">{</span></span><span class=\"syn-meta syn-block syn-rust\"><span class=\"syn-punctuation syn-section syn-block syn-end syn-rust\">}</span></span></span>\n</span></code></pre>"),
("```rust edition2015\nfn main() {}\n```", ("```rust edition2015\nfn main() {}\n```",
"<pre class=\"syntect playground\"><code class=\"language-rust edition2015\"><span class=\"syn-source syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-storage syn-type syn-function syn-rust\">fn</span> </span><span class=\"syn-entity syn-name syn-function syn-rust\">main</span></span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-parameters syn-rust\"><span class=\"syn-punctuation syn-section syn-parameters syn-begin syn-rust\">(</span></span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-parameters syn-rust\"><span class=\"syn-punctuation syn-section syn-parameters syn-end syn-rust\">)</span></span></span></span><span class=\"syn-meta syn-function syn-rust\"> </span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-block syn-rust\"><span class=\"syn-punctuation syn-section syn-block syn-begin syn-rust\">{</span></span><span class=\"syn-meta syn-block syn-rust\"><span class=\"syn-punctuation syn-section syn-block syn-end syn-rust\">}</span></span></span>\n</span></code></pre>"), "<pre class=\"playground\"><code class=\"syntect language-rust edition2015\"><span class=\"syn-source syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-storage syn-type syn-function syn-rust\">fn</span> </span><span class=\"syn-entity syn-name syn-function syn-rust\">main</span></span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-parameters syn-rust\"><span class=\"syn-punctuation syn-section syn-parameters syn-begin syn-rust\">(</span></span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-parameters syn-rust\"><span class=\"syn-punctuation syn-section syn-parameters syn-end syn-rust\">)</span></span></span></span><span class=\"syn-meta syn-function syn-rust\"> </span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-block syn-rust\"><span class=\"syn-punctuation syn-section syn-block syn-begin syn-rust\">{</span></span><span class=\"syn-meta syn-block syn-rust\"><span class=\"syn-punctuation syn-section syn-block syn-end syn-rust\">}</span></span></span>\n</span></code></pre>"),
("```rust edition2018\nfn main() {}\n```", ("```rust edition2018\nfn main() {}\n```",
"<pre class=\"syntect playground\"><code class=\"language-rust edition2018\"><span class=\"syn-source syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-storage syn-type syn-function syn-rust\">fn</span> </span><span class=\"syn-entity syn-name syn-function syn-rust\">main</span></span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-parameters syn-rust\"><span class=\"syn-punctuation syn-section syn-parameters syn-begin syn-rust\">(</span></span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-parameters syn-rust\"><span class=\"syn-punctuation syn-section syn-parameters syn-end syn-rust\">)</span></span></span></span><span class=\"syn-meta syn-function syn-rust\"> </span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-block syn-rust\"><span class=\"syn-punctuation syn-section syn-block syn-begin syn-rust\">{</span></span><span class=\"syn-meta syn-block syn-rust\"><span class=\"syn-punctuation syn-section syn-block syn-end syn-rust\">}</span></span></span>\n</span></code></pre>"), "<pre class=\"playground\"><code class=\"syntect language-rust edition2018\"><span class=\"syn-source syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-storage syn-type syn-function syn-rust\">fn</span> </span><span class=\"syn-entity syn-name syn-function syn-rust\">main</span></span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-parameters syn-rust\"><span class=\"syn-punctuation syn-section syn-parameters syn-begin syn-rust\">(</span></span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-parameters syn-rust\"><span class=\"syn-punctuation syn-section syn-parameters syn-end syn-rust\">)</span></span></span></span><span class=\"syn-meta syn-function syn-rust\"> </span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-block syn-rust\"><span class=\"syn-punctuation syn-section syn-block syn-begin syn-rust\">{</span></span><span class=\"syn-meta syn-block syn-rust\"><span class=\"syn-punctuation syn-section syn-block syn-end syn-rust\">}</span></span></span>\n</span></code></pre>"),
]; ];
for (src, should_be) in &inputs { for (src, should_be) in &inputs {
let got = render_markdown( let got = render_markdown(
@ -789,13 +789,13 @@ more text with spaces
fn add_playground_edition2021() { fn add_playground_edition2021() {
let inputs = [ let inputs = [
("```rust\nx()\n```", ("```rust\nx()\n```",
"<pre class=\"syntect playground\"><code class=\"language-rust edition2021\"><span class=\"boring\"><span class=\"syn-source syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-storage syn-type syn-function syn-rust\">fn</span> </span><span class=\"syn-entity syn-name syn-function syn-rust\">main</span></span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-parameters syn-rust\"><span class=\"syn-punctuation syn-section syn-parameters syn-begin syn-rust\">(</span></span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-parameters syn-rust\"><span class=\"syn-punctuation syn-section syn-parameters syn-end syn-rust\">)</span></span></span></span><span class=\"syn-meta syn-function syn-rust\"> </span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-block syn-rust\"><span class=\"syn-punctuation syn-section syn-block syn-begin syn-rust\">{</span>\n</span></span></span></span><span class=\"syn-source syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-block syn-rust\"><span class=\"syn-support syn-function syn-rust\">x</span><span class=\"syn-meta syn-group syn-rust\"><span class=\"syn-punctuation syn-section syn-group syn-begin syn-rust\">(</span></span><span class=\"syn-meta syn-group syn-rust\"><span class=\"syn-punctuation syn-section syn-group syn-end syn-rust\">)</span></span>\n</span></span></span><span class=\"boring\"><span class=\"syn-source syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-block syn-rust\"><span class=\"syn-punctuation syn-section syn-block syn-end syn-rust\">}</span></span></span>\n</span></span></code></pre>"), "<pre class=\"playground\"><code class=\"syntect language-rust edition2021\"><span class=\"boring\"><span class=\"syn-source syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-storage syn-type syn-function syn-rust\">fn</span> </span><span class=\"syn-entity syn-name syn-function syn-rust\">main</span></span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-parameters syn-rust\"><span class=\"syn-punctuation syn-section syn-parameters syn-begin syn-rust\">(</span></span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-parameters syn-rust\"><span class=\"syn-punctuation syn-section syn-parameters syn-end syn-rust\">)</span></span></span></span><span class=\"syn-meta syn-function syn-rust\"> </span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-block syn-rust\"><span class=\"syn-punctuation syn-section syn-block syn-begin syn-rust\">{</span>\n</span></span></span></span><span class=\"syn-source syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-block syn-rust\"><span class=\"syn-support syn-function syn-rust\">x</span><span class=\"syn-meta syn-group syn-rust\"><span class=\"syn-punctuation syn-section syn-group syn-begin syn-rust\">(</span></span><span class=\"syn-meta syn-group syn-rust\"><span class=\"syn-punctuation syn-section syn-group syn-end syn-rust\">)</span></span>\n</span></span></span><span class=\"boring\"><span class=\"syn-source syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-block syn-rust\"><span class=\"syn-punctuation syn-section syn-block syn-end syn-rust\">}</span></span></span>\n</span></span></code></pre>"),
("```rust\nfn main() {}\n```", ("```rust\nfn main() {}\n```",
"<pre class=\"syntect playground\"><code class=\"language-rust edition2021\"><span class=\"syn-source syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-storage syn-type syn-function syn-rust\">fn</span> </span><span class=\"syn-entity syn-name syn-function syn-rust\">main</span></span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-parameters syn-rust\"><span class=\"syn-punctuation syn-section syn-parameters syn-begin syn-rust\">(</span></span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-parameters syn-rust\"><span class=\"syn-punctuation syn-section syn-parameters syn-end syn-rust\">)</span></span></span></span><span class=\"syn-meta syn-function syn-rust\"> </span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-block syn-rust\"><span class=\"syn-punctuation syn-section syn-block syn-begin syn-rust\">{</span></span><span class=\"syn-meta syn-block syn-rust\"><span class=\"syn-punctuation syn-section syn-block syn-end syn-rust\">}</span></span></span>\n</span></code></pre>"), "<pre class=\"playground\"><code class=\"syntect language-rust edition2021\"><span class=\"syn-source syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-storage syn-type syn-function syn-rust\">fn</span> </span><span class=\"syn-entity syn-name syn-function syn-rust\">main</span></span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-parameters syn-rust\"><span class=\"syn-punctuation syn-section syn-parameters syn-begin syn-rust\">(</span></span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-parameters syn-rust\"><span class=\"syn-punctuation syn-section syn-parameters syn-end syn-rust\">)</span></span></span></span><span class=\"syn-meta syn-function syn-rust\"> </span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-block syn-rust\"><span class=\"syn-punctuation syn-section syn-block syn-begin syn-rust\">{</span></span><span class=\"syn-meta syn-block syn-rust\"><span class=\"syn-punctuation syn-section syn-block syn-end syn-rust\">}</span></span></span>\n</span></code></pre>"),
("```rust edition2015\nfn main() {}\n```", ("```rust edition2015\nfn main() {}\n```",
"<pre class=\"syntect playground\"><code class=\"language-rust edition2015\"><span class=\"syn-source syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-storage syn-type syn-function syn-rust\">fn</span> </span><span class=\"syn-entity syn-name syn-function syn-rust\">main</span></span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-parameters syn-rust\"><span class=\"syn-punctuation syn-section syn-parameters syn-begin syn-rust\">(</span></span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-parameters syn-rust\"><span class=\"syn-punctuation syn-section syn-parameters syn-end syn-rust\">)</span></span></span></span><span class=\"syn-meta syn-function syn-rust\"> </span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-block syn-rust\"><span class=\"syn-punctuation syn-section syn-block syn-begin syn-rust\">{</span></span><span class=\"syn-meta syn-block syn-rust\"><span class=\"syn-punctuation syn-section syn-block syn-end syn-rust\">}</span></span></span>\n</span></code></pre>"), "<pre class=\"playground\"><code class=\"syntect language-rust edition2015\"><span class=\"syn-source syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-storage syn-type syn-function syn-rust\">fn</span> </span><span class=\"syn-entity syn-name syn-function syn-rust\">main</span></span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-parameters syn-rust\"><span class=\"syn-punctuation syn-section syn-parameters syn-begin syn-rust\">(</span></span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-parameters syn-rust\"><span class=\"syn-punctuation syn-section syn-parameters syn-end syn-rust\">)</span></span></span></span><span class=\"syn-meta syn-function syn-rust\"> </span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-block syn-rust\"><span class=\"syn-punctuation syn-section syn-block syn-begin syn-rust\">{</span></span><span class=\"syn-meta syn-block syn-rust\"><span class=\"syn-punctuation syn-section syn-block syn-end syn-rust\">}</span></span></span>\n</span></code></pre>"),
("```rust edition2018\nfn main() {}\n```", ("```rust edition2018\nfn main() {}\n```",
"<pre class=\"syntect playground\"><code class=\"language-rust edition2018\"><span class=\"syn-source syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-storage syn-type syn-function syn-rust\">fn</span> </span><span class=\"syn-entity syn-name syn-function syn-rust\">main</span></span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-parameters syn-rust\"><span class=\"syn-punctuation syn-section syn-parameters syn-begin syn-rust\">(</span></span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-parameters syn-rust\"><span class=\"syn-punctuation syn-section syn-parameters syn-end syn-rust\">)</span></span></span></span><span class=\"syn-meta syn-function syn-rust\"> </span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-block syn-rust\"><span class=\"syn-punctuation syn-section syn-block syn-begin syn-rust\">{</span></span><span class=\"syn-meta syn-block syn-rust\"><span class=\"syn-punctuation syn-section syn-block syn-end syn-rust\">}</span></span></span>\n</span></code></pre>"), "<pre class=\"playground\"><code class=\"syntect language-rust edition2018\"><span class=\"syn-source syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-storage syn-type syn-function syn-rust\">fn</span> </span><span class=\"syn-entity syn-name syn-function syn-rust\">main</span></span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-parameters syn-rust\"><span class=\"syn-punctuation syn-section syn-parameters syn-begin syn-rust\">(</span></span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-parameters syn-rust\"><span class=\"syn-punctuation syn-section syn-parameters syn-end syn-rust\">)</span></span></span></span><span class=\"syn-meta syn-function syn-rust\"> </span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-block syn-rust\"><span class=\"syn-punctuation syn-section syn-block syn-begin syn-rust\">{</span></span><span class=\"syn-meta syn-block syn-rust\"><span class=\"syn-punctuation syn-section syn-block syn-end syn-rust\">}</span></span></span>\n</span></code></pre>"),
]; ];
for (src, should_be) in &inputs { for (src, should_be) in &inputs {
let got = render_markdown( let got = render_markdown(
@ -815,9 +815,9 @@ more text with spaces
fn no_add_playground_to_other_languages() { fn no_add_playground_to_other_languages() {
let inputs = [ let inputs = [
("```html,testhtml\n<p>\n```", ("```html,testhtml\n<p>\n```",
"<pre class=\"syntect\"><code class=\"language-html testhtml\"><span class=\"syn-text syn-html syn-basic\"><span class=\"syn-meta syn-tag syn-block syn-any syn-html\"><span class=\"syn-punctuation syn-definition syn-tag syn-begin syn-html\">&lt;</span><span class=\"syn-entity syn-name syn-tag syn-block syn-any syn-html\">p</span><span class=\"syn-punctuation syn-definition syn-tag syn-end syn-html\">&gt;</span></span>\n</span></code></pre>"), "<pre><code class=\"syntect language-html testhtml\"><span class=\"syn-text syn-html syn-basic\"><span class=\"syn-meta syn-tag syn-block syn-any syn-html\"><span class=\"syn-punctuation syn-definition syn-tag syn-begin syn-html\">&lt;</span><span class=\"syn-entity syn-name syn-tag syn-block syn-any syn-html\">p</span><span class=\"syn-punctuation syn-definition syn-tag syn-end syn-html\">&gt;</span></span>\n</span></code></pre>"),
("```js es7\nf()\n```", ("```js es7\nf()\n```",
"<pre class=\"syntect\"><code class=\"language-js es7\"><span class=\"syn-source syn-js\"><span class=\"syn-meta syn-function-call syn-js\"><span class=\"syn-variable syn-function syn-js\">f</span><span class=\"syn-meta syn-group syn-js\"><span class=\"syn-punctuation syn-section syn-group syn-js\">(</span></span><span class=\"syn-meta syn-group syn-js\"><span class=\"syn-punctuation syn-section syn-group syn-js\">)</span></span></span>\n</span></code></pre>"), "<pre><code class=\"syntect language-js es7\"><span class=\"syn-source syn-js\"><span class=\"syn-meta syn-function-call syn-js\"><span class=\"syn-variable syn-function syn-js\">f</span><span class=\"syn-meta syn-group syn-js\"><span class=\"syn-punctuation syn-section syn-group syn-js\">(</span></span><span class=\"syn-meta syn-group syn-js\"><span class=\"syn-punctuation syn-section syn-group syn-js\">)</span></span></span>\n</span></code></pre>"),
]; ];
for (src, should_be) in &inputs { for (src, should_be) in &inputs {
let got = render_markdown( let got = render_markdown(

View File

@ -144,7 +144,7 @@ fn rendered_code_has_playground_stuff() {
md.build().unwrap(); md.build().unwrap();
let nested = temp.path().join("book/first/nested.html"); let nested = temp.path().join("book/first/nested.html");
let playground_class = vec![r#"class="syntect playground""#]; let playground_class = vec![r#"class="playground""#];
assert_contains_strings(nested, &playground_class); assert_contains_strings(nested, &playground_class);
@ -392,7 +392,7 @@ fn able_to_include_playground_files_in_chapters() {
let second = temp.path().join("book/second.html"); let second = temp.path().join("book/second.html");
let playground_strings = &[ let playground_strings = &[
r#"class="syntect playground""#, r#"class="playground""#,
r#"<span class="syn-support syn-macro syn-rust">println!</span><span class="syn-meta syn-group syn-rust"><span class="syn-punctuation syn-section syn-group syn-begin syn-rust">(</span></span><span class="syn-meta syn-group syn-rust"><span class="syn-string syn-quoted syn-double syn-rust"><span class="syn-punctuation syn-definition syn-string syn-begin syn-rust">&quot;</span>Hello World!"#, r#"<span class="syn-support syn-macro syn-rust">println!</span><span class="syn-meta syn-group syn-rust"><span class="syn-punctuation syn-section syn-group syn-begin syn-rust">(</span></span><span class="syn-meta syn-group syn-rust"><span class="syn-string syn-quoted syn-double syn-rust"><span class="syn-punctuation syn-definition syn-string syn-begin syn-rust">&quot;</span>Hello World!"#,
]; ];