Skip to content

Commit 27faa54

Browse files
authored
Merge pull request #1469 from tuyen-at-work/patch-1
Support space as seperator between language and additional class in c…
2 parents 8fb6ac7 + fae0759 commit 27faa54

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/utils/mod.rs

+9-2
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,14 @@ impl EventQuoteConverter {
228228
fn clean_codeblock_headers(event: Event<'_>) -> Event<'_> {
229229
match event {
230230
Event::Start(Tag::CodeBlock(CodeBlockKind::Fenced(ref info))) => {
231-
let info: String = info.chars().filter(|ch| !ch.is_whitespace()).collect();
231+
let info: String = info
232+
.chars()
233+
.map(|x| match x {
234+
' ' | '\t' => ',',
235+
_ => x,
236+
})
237+
.filter(|ch| !ch.is_whitespace())
238+
.collect();
232239

233240
Event::Start(Tag::CodeBlock(CodeBlockKind::Fenced(CowStr::from(info))))
234241
}
@@ -372,7 +379,7 @@ more text with spaces
372379
```
373380
"#;
374381

375-
let expected = r#"<pre><code class="language-rust,no_run,,,should_panic,,property_3"></code></pre>
382+
let expected = r#"<pre><code class="language-rust,,,,,no_run,,,should_panic,,,,property_3"></code></pre>
376383
"#;
377384
assert_eq!(render_markdown(input, false), expected);
378385
assert_eq!(render_markdown(input, true), expected);

0 commit comments

Comments
 (0)