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:
parent
2ef54b4218
commit
1eaec48b5a
1 changed files with 12 additions and 0 deletions
|
@ -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')
|
||||
|
|
Loading…
Reference in a new issue