Hi, I’m a dev that just got into custom plugins here in obsidian.
I’m trying to render a mathjax equation to display it in a new view on the right sidebar.
My new view functionality is done, but I’m having a hard time trying to render the mathjax equation.
My code is similar to this:
// All basic imports are called
export default class NewPlugin extends Plugin {
// Sets plugin as normal
...
// On plugin load:
// Register new view
// On layout ready adds a new view to the right leaf
}
class NewView extends ItemView {
// Sets view as normal
...
async onOpen() {
let mathjax_text = "$\\rho^2 + 3 = 5$";
let mathjax_element = renderMath(mathjax_text, false);
await finishRenderMath();
}
}
When the new plugin in enabled and the new view is opened a error is thowned in the console:
I’ve looked at the source code of others plugins that functionality and every one is doing the same thing as me “renderMath” then “await finishRenderMath”. I have no ideia why my plugin doesn’t work.
Am I forgetting something? Do I have to import some thing special? Is my obsidian version bugged? Is that a real bug in the newest obsidian version? Is there a new way to do what I’m trying to do?
If more information is needed to solve the problem I can provide it.
Thanks for the help!