Search code examples
htmlpugmathjax

How can I define macros using jade template engine?


When using jade with MathJax, I'm using a lot of such tags:

<script type="math/tex; mode=display">
  some math fomula
</script>

to generate math formula in web pages, so I will be writing

script(type="math/tex; mode=display").
  some math fomula

in jade each time I want to insert formula.

That is annoying, because the script tag is a bit too long and distracts me from the real content, and all such tags are the same.

So I'm wondering is there any way to "define" a tag in jade, so that I can simply write

math.
  some math formula

to generate the html above?


Solution

  • You can use jade mixins to achieve something like that.