mirror of
https://github.com/glassflame/glassflame.github.io.git
synced 2024-11-22 16:14:26 +00:00
Add support for highlight
This commit is contained in:
parent
edf4486cf8
commit
2073029d99
1 changed files with 20 additions and 0 deletions
|
@ -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>`
|
||||||
|
},
|
||||||
|
},
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue