1
Fork 0
mirror of https://github.com/glassflame/glassflame.github.io.git synced 2024-11-23 00:24:25 +00:00

Add support for highlight

This commit is contained in:
Steffo 2023-11-06 18:19:34 +01:00
parent edf4486cf8
commit 2073029d99
Signed by: steffo
GPG key ID: 2A24051445686895

View file

@ -119,6 +119,26 @@ export class MarkdownElement extends CustomElement {
return `<x-math document="${token.document}"></x-math>` return `<x-math document="${token.document}"></x-math>`
} }
}, },
{
name: "highlight",
level: "inline",
start(src) {
return src.match(/==/)?.index
},
tokenizer(src, _) {
const match = src.match(/^==(.+?)==/)
if(match) {
return {
type: "highlight",
raw: match[0],
text: match[1],
}
}
},
renderer(token) {
return `<mark>${token.text}</mark>`
},
},
] ]
}) })