feat: improve table rendering + add markdown-it-decorate module

This commit is contained in:
NGPixel
2022-11-08 22:40:43 -05:00
parent d98e0b3cd0
commit 9fbc25adb8
7 changed files with 107 additions and 5 deletions

View File

@@ -243,6 +243,16 @@ module.exports = {
}
})
// --------------------------------
// Wrap root table nodes
// --------------------------------
$('body').contents().toArray().forEach(item => {
if (item && item.name === 'table' && item.parent.name === 'body') {
$(item).wrap('<div class="table-container"></div>')
}
})
// --------------------------------
// Escape mustache expresions
// --------------------------------

View File

@@ -1,5 +1,6 @@
const md = require('markdown-it')
const mdAttrs = require('markdown-it-attrs')
const mdDecorate = require('markdown-it-decorate')
const _ = require('lodash')
const underline = require('./underline')
@@ -42,6 +43,7 @@ module.exports = {
mkdown.use(mdAttrs, {
allowedAttributes: ['id', 'class', 'target']
})
mkdown.use(mdDecorate)
for (let child of this.children) {
const renderer = require(`../${_.kebabCase(child.key)}/renderer.js`)