1
0
mirror of https://github.com/Luzifer/wiki.git synced 2024-09-18 23:23:00 +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')