cloose / CuteMarkEd

Qt Markdown Editor
http://cloose.github.io/CuteMarkEd
Other
1.46k stars 319 forks source link

Export of Mermaid diagrams #269

Open BsNoSi opened 8 years ago

BsNoSi commented 8 years ago

Mermaid support enhances the usage area of CuteMarkEd very much. It would be perfect, if the HTML export to clipboard would contain MIME64 coded images (PNG) of the diagram. This would support „cut and paste“ of created text into mail, web-pages, a.s.o. without installed mermaid support (esp. mail will never have this).

As a „step between" it would help, if the diagrams are saved as SVG or PNG on export of HTML, like they are embedded in PDF file.

Currently I have to help myself by taking screenshots. Works for me, but it is a little bit more complicated, as is should/could be.

cloose commented 8 years ago

The method buildSVGURL() in http://knsv.github.io/mermaid/live_editor/scripts/controllers/main.js could give hints how to do it.

With the following code, we should be able to find out if we clicked on a mermaid diagram:

QWebHitTestResult hit = page()->mainFrame()->hitTestContent(pressPoint.toPoint());