Math
The default theme can use MathJax to render math notation. All required resources are embedded in the generated site but the rendering is done on the client side with JavaScript. Only a [math]
placeholder will be visible if JavaScript is disabled.
MathJax config files and options for a MathJax.Hub.Config
call can be specified in the theme’s global configuration (under theme.default.global
for the default theme):
This default configuration disables preprocessing (which is not needed if you use Ornate’s math syntax extensions) and preloads a config file with everything that is needed for rendering TeX, AsciiMath and MathML. Since Ornate only adds MathJax to pages that actually need it, the use of a -full
config file is recommended. If you only need AsciiMath notation, you can use the smaller AM_CHTML-full
configuration.
Fenced Code Blocks
Fenced code blocks whose info string starts with the language codes texmath
, asciimath
(or simply math
) and mathml
are
treated as display math instead of passing them on to the standard highlighter.
TeX example:
This is rendered as:
AsciiMath example:
This is rendered as:
mathSyntax
extension
The mathSyntax
extension enables special syntax for inline and display (block) math. There is no single standard notation for math in Markdown, therefore it can be customized to support several common notations:
The
mathSyntax
extension is enabled by default but all notations are disabled.
-
dollarInline
: Standard TeX inline math notation, with the same syntax as Pandoc’stex_math_dollars
extension: Anything between two$
characters is treated as math. The opening$
must have a non-space character immediately to its right, while the closing$
must have a non-space character immediately to its left, and must not be followed immediately by a digit. If for some reason you need to enclose text in literal$
characters, backslash-escape them and they won’t be treated as math delimiters.Example:
This is rendered as:
Here is some inline math [math] but neither is
$a+b$
nor $20,000 and $30,000, nor $a+b$.Note that the inline math notation is parsed before any other inline notation, in particular before inline code. This can have unwanted side effects when using the single dollar syntax. For example, when placing another inline code section
`$a+b$`
at the end of the previous paragraph, everything from$20,000
to the first$
of the inline code section would be recognized as inline math. -
dollarBlock
: Standard TeX display math notation. Blocks delimited by$$
are treated as display math.Example:
This is rendered as:
[math] -
singleBackslash
: Standard LaTeX notation for\(inline\)
and\[display\]
math. -
doubleBackslash
: MultiMarkdown’s adaptation of LaTeX notation for\\(inline\\)
and\\[display\\]
math. -
dollarInlineCode
: Inline code blocks with$
characters at the beginning and end like`$a+b$`
are parsed as inline math. The initial$
can be escaped as\$
to prevent math parsing. -
dollarFenced
: Standard TeX inline math notation (like withdollarInline
) in fenced code blocks. The usual highlighting will be applied to such blocks. In order to minimize unwanted interaction of the highlighter with the unexpected math notation, inline math appears as a regular ASCII identifier to the highlighter. The real math notation is spliced back in after highlighting. This setting can be configured individually for each fenced code block withdollarMath=tex|asciimath|null
in the info string.For example:
This is rendered as: