feat: plantuml in markdown preview

This commit is contained in:
NGPixel
2020-05-08 22:51:32 -04:00
parent cc9f022051
commit 53da387082
7 changed files with 224 additions and 7 deletions

View File

@@ -8,22 +8,25 @@ dependsOn: markdownCore
props:
server:
type: String
default: https://www.plantuml.com/plantuml
default: https://plantuml.requarks.io
title: PlantUML Server
hint: PlantUML server used for image generation
order: 1
public: true
openMarker:
type: String
default: "```plantuml"
title: Open Marker
hint: String to use as opening delimiter
order: 2
public: true
closeMarker:
type: String
default: "```"
title: Close Marker
hint: String to use as closing delimiter
order: 3
public: true
imageFormat:
type: String
default: svg
@@ -35,3 +38,4 @@ props:
- latex
- ascii
order: 4
public: true

View File

@@ -7,12 +7,12 @@ const zlib = require('zlib')
module.exports = {
init (mdinst, conf) {
mdinst.use((md, opts) => {
const openMarker = opts.openMarker || '@startuml'
const openMarker = opts.openMarker || '```plantuml'
const openChar = openMarker.charCodeAt(0)
const closeMarker = opts.closeMarker || '@enduml'
const closeMarker = opts.closeMarker || '```'
const closeChar = closeMarker.charCodeAt(0)
const imageFormat = opts.imageFormat || 'svg'
const server = opts.server || 'https://www.plantuml.com/plantuml'
const server = opts.server || 'https://plantuml.requarks.io'
md.block.ruler.before('fence', 'uml_diagram', (state, startLine, endLine, silent) => {
let nextLine