Hi I’d like to make some web pages with hugo, using its “shortcodes” for rendering math with katex.
# KaTeX
KaTeX shortcode let you render math typesetting in markdown document. See [KaTeX](https://katex.org/)
## Example
{{< katex [display] [class="text-center"] >}}
f(x) = \int_{-\infty}^\infty\hat f(\xi)\,e^{2 \pi i \xi x}\,d\xi
{{< /katex >}}
{{< katex >}}
f(x) = \int_{-\infty}^\infty\hat f(\xi)\,e^{2 \pi i \xi x}\,dξ
{{< /katex >}}
Here is some inline example: {{< katex >}}\pi(x){{< /katex >}}, rendered in the same line.
Eventually I’d also like to make a syntax for katex so I would get embedded highlighting and so on but for now I would be content if the math was highlighted as “raw” text.
I made a simple syntax context that matches the pattern but don’t know where to add it to the Markdown.sublime-syntax
.
%YAML 1.2
---
name: TestSyntax
scope: text.test
contexts:
main:
- include: hugo-shortcode
hugo-shortcode:
- match: \{\{<\s(\w*)\s*([^>\}\}]*)\s>\}\}\n{0,1}
captures:
0: hugo.shortcode.header
1: hugo.shortcode.header.name
2: hugo.shortcode.header.parameters
embed: scope:hugo.shortcode.content
embed_scope: markup.raw.inline.markdown
escape: \{\{<\s/(\1)\s>\}\}
escape_captures:
0: hugo.shortcode.footer
1: hugo.shortcode.footer.name
I’m already using OverrideAudit so I don’t mind if the whole syntax has to be modified but ideally I would have a separate syntax for build hugo sites.