markmap / markmap

Build mindmaps with plain text
https://markmap.js.org/
MIT License
9.19k stars 634 forks source link

Can I get the svg without query slector? #8

Closed dodok8 closed 4 years ago

dodok8 commented 4 years ago

I just want to get stirng data of <svg> tag, result of markmap instead of drawing directly on DOM. Is there an any way to get this?

gera2ld commented 4 years ago

This is not possible now because the size of each cell has to be calculated after it is mounted to document. It's hard to measure the sizes in other ways after supporting different styles, links, MathJax, etc.

What's your use case? How about getting the string by svg.outerHTML?

dodok8 commented 4 years ago

I try to build VS Code extension change markdown into mindmap using your library and Webview API provided by VS Code. Even though I can run JS code in webview.html using <script />, however, it can't access yarn or npm so it occurs error when loaded. I can't find a way to access DOM of webview in outside of webview.html. So I thought 'what about get a string data of mindmap and directly export in webview.html?'. That's the reason I wrote this question.

Thanks for your kind answer. Have a nice day