Syntax highlighting (#691)
* Syntax highlighting mostly... Exists. * Add dependency to dockerfile * Handle non-existent languages better * Make the default a bit nicer * Improve highlighting. Clean up function * Add dark theme, add the comment scope to the allowed classes * update build env * Address review comments * Use find_syntax_by_token which produces the desired behavior * Change flat_map into flatten (commit cargo.lock)
This commit is contained in:
@@ -31,10 +31,41 @@ lazy_static! {
|
||||
.add_tag_attributes("label", ["for"].iter())
|
||||
.add_tag_attributes("input", ["type", "checked"].iter())
|
||||
.add_allowed_classes("input", ["cw-checkbox"].iter())
|
||||
.add_allowed_classes(
|
||||
"span",
|
||||
[
|
||||
"cw-container",
|
||||
"cw-text",
|
||||
//Scope classes for the syntax highlighting.
|
||||
"attribute-name",
|
||||
"comment",
|
||||
"constant",
|
||||
"control",
|
||||
"declaration",
|
||||
"entity",
|
||||
"function",
|
||||
"invalid",
|
||||
"keyword",
|
||||
"language",
|
||||
"modifier",
|
||||
"name",
|
||||
"numeric",
|
||||
"operator",
|
||||
"parameter",
|
||||
"punctuation",
|
||||
"source",
|
||||
"storage",
|
||||
"string",
|
||||
"support",
|
||||
"tag",
|
||||
"type",
|
||||
"variable",
|
||||
]
|
||||
.iter(),
|
||||
)
|
||||
// Related to https://github.com/Plume-org/Plume/issues/637
|
||||
.add_allowed_classes("sup", ["footnote-reference", "footnote-definition-label"].iter())
|
||||
.add_allowed_classes("div", ["footnote-definition"].iter())
|
||||
.add_allowed_classes("span", ["cw-container", "cw-text"].iter())
|
||||
.attribute_filter(|elem, att, val| match (elem, att) {
|
||||
("input", "type") => Some("checkbox".into()),
|
||||
("input", "checked") => Some("checked".into()),
|
||||
|
||||
Reference in New Issue
Block a user