gmunguia / markdown-it-plantuml

:herb: :book: plantuml diagrams in your markdown
MIT License
99 stars 21 forks source link

[FeatureRequest] Add additional diagram types #35

Open hschaefer123 opened 3 years ago

hschaefer123 commented 3 years ago

Hi gmunguia, it would be great, if your plugin would support also addtional diagram types like JSON Data (@startjson) and YAML Data (@startyaml) or Word Breakdown (@startwbs).

Sadly they have an addional syntax and i would have to copy your branch to support it.

The best place would be your plugin supporting the addtional syntaxes as well, if this would be easily possible for you.

Thanks for creating this heavily used plugin.

Best Regards Holger

carlo-quinonez commented 2 years ago

It already supports this. You'll have to use the plugin once for each of the diagram types you want to support.

md.use(require('markdown-it-plantuml'), {
  openMarker: '```plantuml',
  closeMarker: '```',
  diagramName: 'uml',
  imageFormat: 'svg',
});
//Work Breakdown Structure https://plantuml.com/wbs-diagram
md.use(require('markdown-it-plantuml'), {
  openMarker: '```wbs',
  closeMarker: '```',
  diagramName: 'wbs',
  imageFormat: 'svg',
});
// JSON https://plantuml.com/json
md.use(require('markdown-it-plantuml'), {
  openMarker: '```jsondiagrom',
  closeMarker: '```',
  diagramName: 'json',
  imageFormat: 'svg',
});
// YAML https://plantuml.com/yaml
md.use(require('markdown-it-plantuml'), {
  openMarker: '```yamldiagram',
  closeMarker: '```',
  diagramName: 'yaml',
  imageFormat: 'svg',
});
hschaefer123 commented 2 years ago

Hi Carlo, sorry, that i forgot to say thank you for the tip!

Just tried it with ditaa and ran into issues, but figured out, that svg is not supported (just rendering images).

md.use(require('markdown-it-plantuml'), {
  openMarker: '```ditaa',
  closeMarker: '```',
  diagramName: 'ditaa',
  imageFormat: 'png',
});

Thanks for the great plugin!

BTW: How can i pass in ditaa params? Using @startuml i can control it with the seconde line like ditaa(-E)

How is this working, if i am using custom start params like ```ditaa?

I am heavily using it at btp.udina.de

Best Regards Holger