feat: diagram rendering + post-processor (wip)
This commit is contained in:
parent
5f99b30024
commit
52d0af19b4
@ -581,7 +581,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
pre.diagram {
|
||||
.diagram {
|
||||
margin-top: 1rem;
|
||||
}
|
||||
|
||||
|
8
server/modules/rendering/html-diagram/definition.yml
Normal file
8
server/modules/rendering/html-diagram/definition.yml
Normal file
@ -0,0 +1,8 @@
|
||||
key: htmlDiagram
|
||||
title: Diagrams Post-Processor
|
||||
description: HTML Processing for diagrams (draw.io)
|
||||
author: requarks.io
|
||||
icon: mdi-chart-multiline
|
||||
enabledDefault: true
|
||||
dependsOn: htmlCore
|
||||
props: {}
|
10
server/modules/rendering/html-diagram/renderer.js
Normal file
10
server/modules/rendering/html-diagram/renderer.js
Normal file
@ -0,0 +1,10 @@
|
||||
module.exports = {
|
||||
async init($, config) {
|
||||
$(`pre.diagram`).each((idx, elm) => {
|
||||
$(elm).children('svg').each((sidx, svg) => {
|
||||
$(svg).removeAttr('content')
|
||||
})
|
||||
$(elm).replaceWith($(`<div class="diagram">${$(elm).html()}</div>`))
|
||||
})
|
||||
}
|
||||
}
|
@ -27,8 +27,12 @@ module.exports = {
|
||||
typographer: this.config.typographer,
|
||||
quotes: _.get(quoteStyles, this.config.quotes, quoteStyles.English),
|
||||
highlight(str, lang) {
|
||||
if (lang === 'diagram') {
|
||||
return `<pre class="diagram">` + Buffer.from(str, 'base64').toString() + `</pre>`
|
||||
} else {
|
||||
return `<pre><code class="language-${lang}">${_.escape(str)}</code></pre>`
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
if (this.config.underline) {
|
||||
|
Loading…
Reference in New Issue
Block a user