Skip to content

Commit fbeffb0

Browse files
MSSandroidRokt33r
authored andcommitted
Added plantUML mindmap support
1 parent ef0af39 commit fbeffb0

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

browser/lib/markdown.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,22 @@ class Markdown {
211211
}
212212
})
213213

214+
// Mindmap support
215+
this.md.use(require('markdown-it-plantuml'), {
216+
openMarker: '@startmindmap',
217+
closeMarker: '@endmindmap',
218+
generateSource: function (umlCode) {
219+
const stripTrailingSlash = (url) => url.endsWith('/') ? url.slice(0, -1) : url
220+
// Currently PlantUML server doesn't support Ditaa in SVG, so we set the format as PNG at the moment.
221+
const serverAddress = stripTrailingSlash(config.preview.plantUMLServerAddress) + '/svg'
222+
const s = unescape(encodeURIComponent(umlCode))
223+
const zippedCode = deflate.encode64(
224+
deflate.zip_deflate(`@startmindmap\n${s}\n@endmindmap`, 9)
225+
)
226+
return `${serverAddress}/${zippedCode}`
227+
}
228+
})
229+
214230
// Override task item
215231
this.md.block.ruler.at('paragraph', function (state, startLine/*, endLine */) {
216232
let content, terminate, i, l, token

0 commit comments

Comments
 (0)