MathJax: Is it possible to highlight only specific elements and not the whole document?

185 Views Asked by At

I am writing a blog with markdown-functionality, the lib I use is called showdown.js. But this markdown-lib doesn't support formula-rendering. So that's why I wonder, if it is possible, to let MathJax only render a given DOM-Element?
I know, that there is a lib, called showdown-katex, but considering that I use Spring Boot for my server, I am not able to include javascript-libs, installed with npm.

1

There are 1 best solutions below

0
On

Use the elements option in the startup section of your MathJax configuration (documentation:

<script>
MathJax = {
  startup: {
    elements: ['#id', '.class']
  }
};
</script>

where id is replaced by the ID of an element to typeset, or class is replaced by a class that selects the elements to typeset. You can use any CSS selectors, this is just an example.