simonhaenisch / md-to-pdf

Hackable CLI tool for converting Markdown files to PDF using Node.js and headless Chrome.
https://www.npmjs.com/md-to-pdf
MIT License
1.2k stars 110 forks source link

feature: Render Markdown with inline PlantUML #41

Open sangxxh opened 5 years ago

sangxxh commented 5 years ago

Problem:

It'd be very powerful if md-to-pdf can also render inline PlantUML diagrams when converting .md to .pdf

Solution:

Use a PlantUML parser to convert text within uml or plantuml code block to SVG image and render them along with the PDF:

```plantuml
@startuml
:Hello world;
:This is defined on
several **lines**;
@enduml
simonhaenisch commented 5 years ago

Interesting idea, but I'd rather not implement it in the core (since there's many other diagram syntaxes)... instead, marked is pretty simple to extend, so I assume it would be pretty straightforward to inject a plantuml parser.

I'll think about how I can expose extending the parser, and keep you updated. I'm working on a new major release though (v3), so this feature will only come along with that release.

hadrien-toma commented 4 years ago

@simonhaenisch is the parser exposed now? Can you provide an example on how to extend it? This sounds very interesting! :heart_eyes:

simonhaenisch commented 4 years ago

No I don't think it's exposed yet (only options which includes the renderer) but I'm open to PRs for that 🤓 (I don't have much free time at the moment)

PeterDaveHello commented 6 months ago

This will be a great feature, would love to see it very much!