lynchjames / obsidian-mind-map

An Obsidian plugin for displaying markdown notes as mind maps using Markmap.
MIT License
1.1k stars 77 forks source link

Mind map fails at rendering mathematical elements #64

Open Hadrien-lcrx opened 2 years ago

Hadrien-lcrx commented 2 years ago

@lynchjames I noticed that the mind map rendering section doesn't render mathematical elements written in LaTeX.

Although this is not my area of expertise, is there anything I can do to help make this possible, if you have an idea how to go about this?

image

Hadrien-lcrx commented 2 years ago

Turns out this Obsidian plugin which builds on top of the Obsidian Mind Map plugin solves this issues.

Just follow the installation instructions on the repo's README, potentially do what is recommended here if you fail to load the plugin in Obsidian, and add the following code on top of your note to be able to click on the 3 vertical dots and render the note as a mind map.

---
mindmap-plugin: basic
---

image image

lucasnobre212 commented 2 years ago

I tried this and couldn't export images :(

MindMap creates the katex html correctly, but it does not render because katex is not imported in Obsidian. A quick fix is import katex in obsidian by downloading this plugin: https://github.com/ryanpcmcquen/obsidian-javascript-init and adding this code in the plugin:


const node1 = document.createElement('link')
node1.setAttribute("rel", "stylesheet")
node1.setAttribute("href", "https://cdn.jsdelivr.net/npm/katex@0.15.3/dist/katex.css")
node1.setAttribute("integrity", "sha384-A3N+UgNMKg9+LRsC2HUE0ECxFY7qhztVFORxHQZEPm7lnog2poqmm7CQ91wSEnBc")
node1.setAttribute("crossorigin", "anonymous")
var address = document.getElementsByTagName('head')[0]
address.appendChild(node1)

const node2 = document.createElement('script')
node2.setAttribute("defer", "")
node2.setAttribute("src", "https://cdn.jsdelivr.net/npm/katex@0.15.3/dist/katex.js")
node2.setAttribute("integrity", "sha384-D0gipC03W+lifpletIVjX+11DUvrzNAMhVux0JrrAMt9Ufgu9HcPdS5GxZSDmNxx")
node2.setAttribute("crossorigin", "anonymous")
var address = document.getElementsByTagName('head')[0]
address.appendChild(node2)

There should be a more elegant way to add this to obsidian, but I don't know how. My "solution" is probably a hint towards the real problem, but I couldn't find it

appw-cn commented 2 years ago

I have the same problem.

@lynchjames I noticed that the mind map rendering section doesn't render mathematical elements written in LaTeX.

Although this is not my area of expertise, is there anything I can do to help make this possible, if you have an idea how to go about this?

image