obsidian-functionplot icon indicating copy to clipboard operation
obsidian-functionplot copied to clipboard

Allow titles with math notation

Open ShahriarKh opened this issue 3 years ago • 3 comments

What's your feature?

Since we are dealing with math, I believe it's really required to be able to have math equations in the title. For example: title: $\lim_{x\to a}$

Any related problems?

No response

Additional context?

No response

ShahriarKh avatar Nov 16 '22 19:11 ShahriarKh

Agree. We could use renderMath to render the equation into the title element. Maybe just skip this step if no mathjax is detected. Great idea btw.

leonhma avatar Nov 16 '22 20:11 leonhma

So, this: https://github.com/leonhma/obsidian-functionplot/blob/2a69384215690967a02c7b39ef644b11a3aadd5a/src/common/utils.ts#L19 should change to something like

title: ${options.title is math ? renderMath(options.title) : options.title}

ShahriarKh avatar Nov 16 '22 21:11 ShahriarKh

Yes. Either that or we could support the $ ... $ syntax obsidian uses. I don't exactly know how renderMath works but we should have a function that renders text to html element and also handles math. Then we could use it as a component for the title and legends.

leonhma avatar Nov 16 '22 21:11 leonhma