Also add highlighting for paths.
This commit is contained in:
@@ -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(".", "_")
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user