Support space as seperator between language and additional class in code block
This PR try to resolve this issue: https://github.com/rust-lang/mdBook/issues/1384
This commit is contained in:
parent
8fb6ac7987
commit
7cae3a058d
|
@ -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 {
|
||||||
|
' ' => ',',
|
||||||
|
_ => 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))))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue