Merge pull request #1469 from tuyen-at-work/patch-1
Support space as seperator between language and additional class in c…
This commit is contained in:
commit
27faa54ae8
|
@ -228,7 +228,14 @@ impl EventQuoteConverter {
|
||||||
fn clean_codeblock_headers(event: Event<'_>) -> Event<'_> {
|
fn clean_codeblock_headers(event: Event<'_>) -> Event<'_> {
|
||||||
match event {
|
match event {
|
||||||
Event::Start(Tag::CodeBlock(CodeBlockKind::Fenced(ref info))) => {
|
Event::Start(Tag::CodeBlock(CodeBlockKind::Fenced(ref info))) => {
|
||||||
let info: String = info.chars().filter(|ch| !ch.is_whitespace()).collect();
|
let info: String = info
|
||||||
|
.chars()
|
||||||
|
.map(|x| match x {
|
||||||
|
' ' | '\t' => ',',
|
||||||
|
_ => x,
|
||||||
|
})
|
||||||
|
.filter(|ch| !ch.is_whitespace())
|
||||||
|
.collect();
|
||||||
|
|
||||||
Event::Start(Tag::CodeBlock(CodeBlockKind::Fenced(CowStr::from(info))))
|
Event::Start(Tag::CodeBlock(CodeBlockKind::Fenced(CowStr::from(info))))
|
||||||
}
|
}
|
||||||
|
@ -372,7 +379,7 @@ more text with spaces
|
||||||
```
|
```
|
||||||
"#;
|
"#;
|
||||||
|
|
||||||
let expected = r#"<pre><code class="language-rust,no_run,,,should_panic,,property_3"></code></pre>
|
let expected = r#"<pre><code class="language-rust,,,,,no_run,,,should_panic,,,,property_3"></code></pre>
|
||||||
"#;
|
"#;
|
||||||
assert_eq!(render_markdown(input, false), expected);
|
assert_eq!(render_markdown(input, false), expected);
|
||||||
assert_eq!(render_markdown(input, true), expected);
|
assert_eq!(render_markdown(input, true), expected);
|
||||||
|
|
Loading…
Reference in New Issue