1
0
Fork 0
mirror of https://github.com/Luzifer/wiki.git synced 2024-11-09 15:20:07 +00:00

Add automatic class bindings

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2024-01-30 16:36:16 +01:00
parent 2ef54b4218
commit 1eaec48b5a
Signed by: luzifer
SSH key fingerprint: SHA256:/xtE5lCgiRDQr8SLxHMS92ZBlACmATUmF1crK16Ks4E

View file

@ -6,6 +6,17 @@
<script>
import showdown from 'showdown'
const classMap = {
table: 'table',
}
const htmlClassBindings = Object.keys(classMap)
.map(key => ({
regex: new RegExp(`<${key}(.*)>`, 'g'),
replace: `<${key} class="${classMap[key]}" $1>`,
type: 'output',
}))
export default {
data() {
return {
@ -37,6 +48,7 @@ export default {
}
const converter = new showdown.Converter({
extensions: [...htmlClassBindings],
tables: true,
})
converter.setFlavor('github')