Also add highlighting for paths.

This commit is contained in:
Tom Alexander
2025-02-22 16:55:53 -05:00
parent 3245e830d2
commit c4cf814f8d
3 changed files with 18 additions and 3 deletions

View File

@@ -47,7 +47,7 @@ render!(RenderSrcBlock, ISrcBlock, original, _render_context, {
content: body.to_owned(),
},
ISrcSegment::HighlightStart { name } => RenderSrcSegment::HighlightStart {
name: name.to_owned(),
name: css_safe_name(name),
},
ISrcSegment::HighlightEnd => RenderSrcSegment::HighlightEnd,
})
@@ -61,3 +61,11 @@ render!(RenderSrcBlock, ISrcBlock, original, _render_context, {
post_blank: original.post_blank,
})
});
fn css_safe_name<S>(inp: S) -> String
where
std::string::String: From<S>,
{
let inp: String = inp.into();
inp.replace(".", "_")
}

View File

@@ -138,9 +138,11 @@ where
L: Borrow<str>,
{
let highlight_names = [
"comment", "keyword", "property",
"comment",
"keyword",
"property",
"string",
// "string.special.path",
"string.special.path",
// "string.special.uri",
];
// Need 1 highlighter per thread