Skip to content

Commit 5044bdd

Browse files
MSSandroidRokt33r
authored andcommitted
Added plantUML wbs support
1 parent fbeffb0 commit 5044bdd

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
@@ -227,6 +227,22 @@ class Markdown {
227227
}
228228
})
229229

230+
// WBS support
231+
this.md.use(require('markdown-it-plantuml'), {
232+
openMarker: '@startwbs',
233+
closeMarker: '@endwbs',
234+
generateSource: function (umlCode) {
235+
const stripTrailingSlash = (url) => url.endsWith('/') ? url.slice(0, -1) : url
236+
// Currently PlantUML server doesn't support Ditaa in SVG, so we set the format as PNG at the moment.
237+
const serverAddress = stripTrailingSlash(config.preview.plantUMLServerAddress) + '/svg'
238+
const s = unescape(encodeURIComponent(umlCode))
239+
const zippedCode = deflate.encode64(
240+
deflate.zip_deflate(`@startwbs\n${s}\n@endwbs`, 9)
241+
)
242+
return `${serverAddress}/${zippedCode}`
243+
}
244+
})
245+
230246
// Override task item
231247
this.md.block.ruler.at('paragraph', function (state, startLine/*, endLine */) {
232248
let content, terminate, i, l, token

0 commit comments

Comments
 (0)