Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Welcome to Codidact Meta!

Codidact Meta is the meta-discussion site for the Codidact community network and the Codidact software. Whether you have bug reports or feature requests, support questions or rule discussions that touch the whole network – this is the site for you.

Post History

66%
+2 −0
Q&A MathML and the math tag - MathJax without JavaScript

Allow use of the <math> tag directly Whether we convert MathJax to MathML behind the scenes or not, users should be able to directly add <math> tags to their posts. We currently allow...

posted 1mo ago by trichoplax‭  ·  edited 1mo ago by trichoplax‭

Answer
#6: Post edited by user avatar trichoplax‭ · 2025-04-06T17:41:46Z (about 1 month ago)
Show what it looks like without MathJax enabled
  • ## Allow use of the `<math>` tag directly
  • Whether we convert MathJax to MathML behind the scenes or not, users should be able to directly add `<math>` tags to their posts.
  • We currently allow both Markdown and HTML in posts. Markdown has the advantages of being quicker to write and easier to read when not rendered (such as during editing). HTML has the advantage of allowing some things that are not possible in Markdown, such as collapsible hidden sections using a `<details>` tag.
  • Similarly, I'd like to see both MathJax and MathML allowed in posts. MathJax has the advantages of being quicker to write and easier to read when not rendered. MathML has the advantages of rendering faster and not requiring JavaScript to be enabled.
  • ## Communities that do not have MathJax enabled
  • - For communities that already have MathJax, I'd like to see MathML available too.
  • - For communities that do not have MathJax, I'd still like to see MathML available.
  • Unlike MathJax, which slows down page loading and increases data usage due to the extra JavaScript that must be loaded, MathML is built into the browser so enabling it will have no effect on loading time or data usage. I see no reason to have a community-specific switch for MathML. We can simply stop blocking it for all communities, and let the browser handle it automatically.
  • ## MathML is straightforward to enable
  • No code change is required to allow the use of a `<math>` tag in a post. All that is required is to add 'math' to the list of allowed tags[^1]. I've tested this in my local development environment. Here's a comparison of MathML then MathJax in a post:
  • > ![Fractions displayed with a horizontal bar, inline in a sentence and on a separate line slightly larger](https://meta.codidact.com/uploads/jhpun9es6hk1dlz9aqpnl3vvafjj)
  • The first of each pair is MathML, the second is MathJax. In this screenshot they look identical. They look this this in both the editor preview and the saved post. In the live post that I'm viewing locally, the only difference is that if I press refresh the MathJax versions momentarily turn back to raw MathJax, whereas the MathML stays as mathematical notation. The raw MathML never shows, even on a slow connection, in the same way that raw HTML never shows, even on a slow connection.
  • <details>
  • <summary>The MathML and MathJax used to produce this screenshot</summary>
  • ```text
  • A fraction inline in the middle of a sentence <math>
  • <mfrac>
  • <mrow>
  • <mn>1</mn>
  • <mo>+</mo>
  • <mn>4</mn>
  • </mrow>
  • <mn>23</mn>
  • </mfrac>
  • </math> as an example.
  • A fraction inline in the middle of a sentence $\frac{1+4}{23}$ as an example.
  • A fraction on its own line:
  • <math display="block">
  • <mfrac>
  • <mrow>
  • <mn>1</mn>
  • <mo>+</mo>
  • <mn>4</mn>
  • </mrow>
  • <mn>23</mn>
  • </mfrac>
  • </math>
  • A fraction on its own line:
  • $$\frac{1+4}{23}$$
  • ```
  • </details>
  • [^1]: To be useful, we'd also need the tags that are used inside a `<math>` tag, such as `<mn>`, `<mo>`, `<mfrac>`, `<mrow>`, but this is still just a matter of adding them to the list of allowed tags. To allow mathematical notation on its own line (rather than inline in a sentence) we'd also need to add 'display' to the list of allowed attributes, to allow `<math display="block">`, but that's the full extent of the changes I needed to make to get this working in my local development environment - simply adding names to 2 lists.
  • ## Allow use of the `<math>` tag directly
  • Whether we convert MathJax to MathML behind the scenes or not, users should be able to directly add `<math>` tags to their posts.
  • We currently allow both Markdown and HTML in posts. Markdown has the advantages of being quicker to write and easier to read when not rendered (such as during editing). HTML has the advantage of allowing some things that are not possible in Markdown, such as collapsible hidden sections using a `<details>` tag.
  • Similarly, I'd like to see both MathJax and MathML allowed in posts. MathJax has the advantages of being quicker to write and easier to read when not rendered. MathML has the advantages of rendering faster and not requiring JavaScript to be enabled.
  • ## Communities that do not have MathJax enabled
  • - For communities that already have MathJax, I'd like to see MathML available too.
  • - For communities that do not have MathJax, I'd still like to see MathML available.
  • Unlike MathJax, which slows down page loading and increases data usage due to the extra JavaScript that must be loaded, MathML is built into the browser so enabling it will have no effect on loading time or data usage. I see no reason to have a community-specific switch for MathML. We can simply stop blocking it for all communities, and let the browser handle it automatically.
  • ## MathML is straightforward to enable
  • No code change is required to allow the use of a `<math>` tag in a post. All that is required is to add 'math' to the list of allowed tags[^1]. I've tested this in my local development environment. Here's a comparison of MathML then MathJax in a post:
  • > ![Fractions displayed with a horizontal bar, inline in a sentence and on a separate line slightly larger](https://meta.codidact.com/uploads/jhpun9es6hk1dlz9aqpnl3vvafjj)
  • The first of each pair is MathML, the second is MathJax. In this screenshot they look identical. They look this this in both the editor preview and the saved post. In the live post that I'm viewing locally, the only difference is that if I press refresh the MathJax versions momentarily turn back to raw MathJax, whereas the MathML stays as mathematical notation. The raw MathML never shows, even on a slow connection, in the same way that raw HTML never shows, even on a slow connection.
  • <details>
  • <summary>The MathML and MathJax used to produce this screenshot</summary>
  • ```text
  • A fraction inline in the middle of a sentence <math>
  • <mfrac>
  • <mrow>
  • <mn>1</mn>
  • <mo>+</mo>
  • <mn>4</mn>
  • </mrow>
  • <mn>23</mn>
  • </mfrac>
  • </math> as an example.
  • A fraction inline in the middle of a sentence $\frac{1+4}{23}$ as an example.
  • A fraction on its own line:
  • <math display="block">
  • <mfrac>
  • <mrow>
  • <mn>1</mn>
  • <mo>+</mo>
  • <mn>4</mn>
  • </mrow>
  • <mn>23</mn>
  • </mfrac>
  • </math>
  • A fraction on its own line:
  • $$\frac{1+4}{23}$$
  • ```
  • </details>
  • On a community that does not have MathJax enabled (or for a user who has JavaScript disabled), that same post looks like this:
  • > ![Fractions displayed with a horizontal bar, inline in a sentence and on a separate line slightly larger, with MathJax versions showing as raw MathJax](https://meta.codidact.com/uploads/144itxskma6xzlvut17hj1ouomlp)
  • The MathJax versions are not rendered, showing instead as raw MathJax, but the MathML versions are correctly rendered as mathematical notation. Notice that the MathML is rendered in a slightly different font when MathJax is not enabled, but it is still in the correct format. If we wanted perfect replication of the look that MathJax gives, we could include the relevant font in Codidact pages. This would only need to be loaded the first time a Codidact page is viewed, and during that brief loading time the MathML would already be correctly displayed, just in a slightly different font - no raw markup.
  • [^1]: To be useful, we'd also need the tags that are used inside a `<math>` tag, such as `<mn>`, `<mo>`, `<mfrac>`, `<mrow>`, but this is still just a matter of adding them to the list of allowed tags. To allow mathematical notation on its own line (rather than inline in a sentence) we'd also need to add 'display' to the list of allowed attributes, to allow `<math display="block">`, but that's the full extent of the changes I needed to make to get this working in my local development environment - simply adding names to 2 lists.
#5: Post edited by user avatar trichoplax‭ · 2025-04-06T17:25:15Z (about 1 month ago)
Mention works in both preview and post
  • ## Allow use of the `<math>` tag directly
  • Whether we convert MathJax to MathML behind the scenes or not, users should be able to directly add `<math>` tags to their posts.
  • We currently allow both Markdown and HTML in posts. Markdown has the advantages of being quicker to write and easier to read when not rendered (such as during editing). HTML has the advantage of allowing some things that are not possible in Markdown, such as collapsible hidden sections using a `<details>` tag.
  • Similarly, I'd like to see both MathJax and MathML allowed in posts. MathJax has the advantages of being quicker to write and easier to read when not rendered. MathML has the advantages of rendering faster and not requiring JavaScript to be enabled.
  • ## Communities that do not have MathJax enabled
  • - For communities that already have MathJax, I'd like to see MathML available too.
  • - For communities that do not have MathJax, I'd still like to see MathML available.
  • Unlike MathJax, which slows down page loading and increases data usage due to the extra JavaScript that must be loaded, MathML is built into the browser so enabling it will have no effect on loading time or data usage. I see no reason to have a community-specific switch for MathML. We can simply stop blocking it for all communities, and let the browser handle it automatically.
  • ## MathML is straightforward to enable
  • No code change is required to allow the use of a `<math>` tag in a post. All that is required is to add 'math' to the list of allowed tags[^1]. I've tested this in my local development environment. Here's a comparison of MathML then MathJax in a post:
  • > ![Fractions displayed with a horizontal bar, inline in a sentence and on a separate line slightly larger](https://meta.codidact.com/uploads/jhpun9es6hk1dlz9aqpnl3vvafjj)
  • The first of each pair is MathML, the second is MathJax. In this screenshot they look identical. In the live post that I'm viewing locally, the only difference is that if I press refresh the MathJax versions momentarily turn back to raw MathJax, whereas the MathML stays as mathematical notation. The raw MathML never shows, even on a slow connection, in the same way that raw HTML never shows, even on a slow connection.
  • <details>
  • <summary>The MathML and MathJax used to produce this screenshot</summary>
  • ```text
  • A fraction inline in the middle of a sentence <math>
  • <mfrac>
  • <mrow>
  • <mn>1</mn>
  • <mo>+</mo>
  • <mn>4</mn>
  • </mrow>
  • <mn>23</mn>
  • </mfrac>
  • </math> as an example.
  • A fraction inline in the middle of a sentence $\frac{1+4}{23}$ as an example.
  • A fraction on its own line:
  • <math display="block">
  • <mfrac>
  • <mrow>
  • <mn>1</mn>
  • <mo>+</mo>
  • <mn>4</mn>
  • </mrow>
  • <mn>23</mn>
  • </mfrac>
  • </math>
  • A fraction on its own line:
  • $$\frac{1+4}{23}$$
  • ```
  • </details>
  • [^1]: To be useful, we'd also need the tags that are used inside a `<math>` tag, such as `<mn>`, `<mo>`, `<mfrac>`, `<mrow>`, but this is still just a matter of adding them to the list of allowed tags. To allow mathematical notation on its own line (rather than inline in a sentence) we'd also need to add 'display' to the list of allowed attributes, to allow `<math display="block">`, but that's the full extent of the changes I needed to make to get this working in my local development environment - simply adding names to 2 lists.
  • ## Allow use of the `<math>` tag directly
  • Whether we convert MathJax to MathML behind the scenes or not, users should be able to directly add `<math>` tags to their posts.
  • We currently allow both Markdown and HTML in posts. Markdown has the advantages of being quicker to write and easier to read when not rendered (such as during editing). HTML has the advantage of allowing some things that are not possible in Markdown, such as collapsible hidden sections using a `<details>` tag.
  • Similarly, I'd like to see both MathJax and MathML allowed in posts. MathJax has the advantages of being quicker to write and easier to read when not rendered. MathML has the advantages of rendering faster and not requiring JavaScript to be enabled.
  • ## Communities that do not have MathJax enabled
  • - For communities that already have MathJax, I'd like to see MathML available too.
  • - For communities that do not have MathJax, I'd still like to see MathML available.
  • Unlike MathJax, which slows down page loading and increases data usage due to the extra JavaScript that must be loaded, MathML is built into the browser so enabling it will have no effect on loading time or data usage. I see no reason to have a community-specific switch for MathML. We can simply stop blocking it for all communities, and let the browser handle it automatically.
  • ## MathML is straightforward to enable
  • No code change is required to allow the use of a `<math>` tag in a post. All that is required is to add 'math' to the list of allowed tags[^1]. I've tested this in my local development environment. Here's a comparison of MathML then MathJax in a post:
  • > ![Fractions displayed with a horizontal bar, inline in a sentence and on a separate line slightly larger](https://meta.codidact.com/uploads/jhpun9es6hk1dlz9aqpnl3vvafjj)
  • The first of each pair is MathML, the second is MathJax. In this screenshot they look identical. They look this this in both the editor preview and the saved post. In the live post that I'm viewing locally, the only difference is that if I press refresh the MathJax versions momentarily turn back to raw MathJax, whereas the MathML stays as mathematical notation. The raw MathML never shows, even on a slow connection, in the same way that raw HTML never shows, even on a slow connection.
  • <details>
  • <summary>The MathML and MathJax used to produce this screenshot</summary>
  • ```text
  • A fraction inline in the middle of a sentence <math>
  • <mfrac>
  • <mrow>
  • <mn>1</mn>
  • <mo>+</mo>
  • <mn>4</mn>
  • </mrow>
  • <mn>23</mn>
  • </mfrac>
  • </math> as an example.
  • A fraction inline in the middle of a sentence $\frac{1+4}{23}$ as an example.
  • A fraction on its own line:
  • <math display="block">
  • <mfrac>
  • <mrow>
  • <mn>1</mn>
  • <mo>+</mo>
  • <mn>4</mn>
  • </mrow>
  • <mn>23</mn>
  • </mfrac>
  • </math>
  • A fraction on its own line:
  • $$\frac{1+4}{23}$$
  • ```
  • </details>
  • [^1]: To be useful, we'd also need the tags that are used inside a `<math>` tag, such as `<mn>`, `<mo>`, `<mfrac>`, `<mrow>`, but this is still just a matter of adding them to the list of allowed tags. To allow mathematical notation on its own line (rather than inline in a sentence) we'd also need to add 'display' to the list of allowed attributes, to allow `<math display="block">`, but that's the full extent of the changes I needed to make to get this working in my local development environment - simply adding names to 2 lists.
#4: Post edited by user avatar trichoplax‭ · 2025-04-06T06:43:16Z (about 1 month ago)
Improve sentence clarity
  • ## Allow use of the `<math>` tag directly
  • Whether we convert MathJax to MathML behind the scenes or not, users should be able to directly add `<math>` tags to their posts.
  • We currently allow both Markdown and HTML in posts. Markdown has the advantages of being quicker to write and easier to read when not rendered (such as during editing). HTML has the advantage of allowing some things that are not possible in Markdown, such as collapsible hidden sections using a `<details>` tag.
  • Similarly, I'd like to see both MathJax and MathML allowed in posts. MathJax has the advantages of being quicker to write and easier to read when not rendered. MathML has the advantages of rendering faster and not requiring JavaScript to be enabled.
  • ## Communities that do not have MathJax enabled
  • - For communities that already have MathJax, I'd like to see MathML available too.
  • - For communities that do not have MathJax, I'd still like to see MathML available.
  • Unlike MathJax, which slows down page loading and increases data usage due to the extra JavaScript that must be loaded, MathML is built into the browser so enabling it will have no effect on loading time or data usage. I see no reason to have a community-specific switch for MathML. We can simply stop blocking it, and let the browser handle it automatically.
  • ## MathML is straightforward to enable
  • No code change is required to allow the use of a `<math>` tag in a post. All that is required is to add 'math' to the list of allowed tags[^1]. I've tested this in my local development environment. Here's a comparison of MathML then MathJax in a post:
  • > ![Fractions displayed with a horizontal bar, inline in a sentence and on a separate line slightly larger](https://meta.codidact.com/uploads/jhpun9es6hk1dlz9aqpnl3vvafjj)
  • The first of each pair is MathML, the second is MathJax. In this screenshot they look identical. In the live post that I'm viewing locally, the only difference is that if I press refresh the MathJax versions momentarily turn back to raw MathJax, whereas the MathML stays as mathematical notation. The raw MathML never shows, even on a slow connection, in the same way that raw HTML never shows, even on a slow connection.
  • <details>
  • <summary>The MathML and MathJax used to produce this screenshot</summary>
  • ```text
  • A fraction inline in the middle of a sentence <math>
  • <mfrac>
  • <mrow>
  • <mn>1</mn>
  • <mo>+</mo>
  • <mn>4</mn>
  • </mrow>
  • <mn>23</mn>
  • </mfrac>
  • </math> as an example.
  • A fraction inline in the middle of a sentence $\frac{1+4}{23}$ as an example.
  • A fraction on its own line:
  • <math display="block">
  • <mfrac>
  • <mrow>
  • <mn>1</mn>
  • <mo>+</mo>
  • <mn>4</mn>
  • </mrow>
  • <mn>23</mn>
  • </mfrac>
  • </math>
  • A fraction on its own line:
  • $$\frac{1+4}{23}$$
  • ```
  • </details>
  • [^1]: To be useful, we'd also need the tags that are used inside a `<math>` tag, such as `<mn>`, `<mo>`, `<mfrac>`, `<mrow>`, but this is still just a matter of adding them to the list of allowed tags. To allow mathematical notation on its own line (rather than inline in a sentence) we'd also need to add 'display' to the list of allowed attributes, to allow `<math display="block">`, but that's the full extent of the changes I needed to make to get this working in my local development environment - simply adding names to 2 lists.
  • ## Allow use of the `<math>` tag directly
  • Whether we convert MathJax to MathML behind the scenes or not, users should be able to directly add `<math>` tags to their posts.
  • We currently allow both Markdown and HTML in posts. Markdown has the advantages of being quicker to write and easier to read when not rendered (such as during editing). HTML has the advantage of allowing some things that are not possible in Markdown, such as collapsible hidden sections using a `<details>` tag.
  • Similarly, I'd like to see both MathJax and MathML allowed in posts. MathJax has the advantages of being quicker to write and easier to read when not rendered. MathML has the advantages of rendering faster and not requiring JavaScript to be enabled.
  • ## Communities that do not have MathJax enabled
  • - For communities that already have MathJax, I'd like to see MathML available too.
  • - For communities that do not have MathJax, I'd still like to see MathML available.
  • Unlike MathJax, which slows down page loading and increases data usage due to the extra JavaScript that must be loaded, MathML is built into the browser so enabling it will have no effect on loading time or data usage. I see no reason to have a community-specific switch for MathML. We can simply stop blocking it for all communities, and let the browser handle it automatically.
  • ## MathML is straightforward to enable
  • No code change is required to allow the use of a `<math>` tag in a post. All that is required is to add 'math' to the list of allowed tags[^1]. I've tested this in my local development environment. Here's a comparison of MathML then MathJax in a post:
  • > ![Fractions displayed with a horizontal bar, inline in a sentence and on a separate line slightly larger](https://meta.codidact.com/uploads/jhpun9es6hk1dlz9aqpnl3vvafjj)
  • The first of each pair is MathML, the second is MathJax. In this screenshot they look identical. In the live post that I'm viewing locally, the only difference is that if I press refresh the MathJax versions momentarily turn back to raw MathJax, whereas the MathML stays as mathematical notation. The raw MathML never shows, even on a slow connection, in the same way that raw HTML never shows, even on a slow connection.
  • <details>
  • <summary>The MathML and MathJax used to produce this screenshot</summary>
  • ```text
  • A fraction inline in the middle of a sentence <math>
  • <mfrac>
  • <mrow>
  • <mn>1</mn>
  • <mo>+</mo>
  • <mn>4</mn>
  • </mrow>
  • <mn>23</mn>
  • </mfrac>
  • </math> as an example.
  • A fraction inline in the middle of a sentence $\frac{1+4}{23}$ as an example.
  • A fraction on its own line:
  • <math display="block">
  • <mfrac>
  • <mrow>
  • <mn>1</mn>
  • <mo>+</mo>
  • <mn>4</mn>
  • </mrow>
  • <mn>23</mn>
  • </mfrac>
  • </math>
  • A fraction on its own line:
  • $$\frac{1+4}{23}$$
  • ```
  • </details>
  • [^1]: To be useful, we'd also need the tags that are used inside a `<math>` tag, such as `<mn>`, `<mo>`, `<mfrac>`, `<mrow>`, but this is still just a matter of adding them to the list of allowed tags. To allow mathematical notation on its own line (rather than inline in a sentence) we'd also need to add 'display' to the list of allowed attributes, to allow `<math display="block">`, but that's the full extent of the changes I needed to make to get this working in my local development environment - simply adding names to 2 lists.
#3: Post edited by user avatar trichoplax‭ · 2025-04-06T06:35:55Z (about 1 month ago)
Make heading more explicit
  • ## Allow use of the `<math>` tag directly
  • Whether we convert MathJax to MathML behind the scenes or not, users should be able to directly add `<math>` tags to their posts.
  • We currently allow both Markdown and HTML in posts. Markdown has the advantages of being quicker to write and easier to read when not rendered (such as during editing). HTML has the advantage of allowing some things that are not possible in Markdown, such as collapsible hidden sections using a `<details>` tag.
  • Similarly, I'd like to see both MathJax and MathML allowed in posts. MathJax has the advantages of being quicker to write and easier to read when not rendered. MathML has the advantages of rendering faster and not requiring JavaScript to be enabled.
  • ## Communities that do not have MathJax enabled
  • - For communities that already have MathJax, I'd like to see MathML available too.
  • - For communities that do not have MathJax, I'd still like to see MathML available.
  • Unlike MathJax, which slows down page loading and increases data usage due to the extra JavaScript that must be loaded, MathML is built into the browser so enabling it will have no effect on loading time or data usage. I see no reason to have a community-specific switch for MathML. We can simply stop blocking it, and let the browser handle it automatically.
  • ## This is straightforward to enable
  • No code change is required to allow the use of a `<math>` tag in a post. All that is required is to add 'math' to the list of allowed tags[^1]. I've tested this in my local development environment. Here's a comparison of MathML then MathJax in a post:
  • > ![Fractions displayed with a horizontal bar, inline in a sentence and on a separate line slightly larger](https://meta.codidact.com/uploads/jhpun9es6hk1dlz9aqpnl3vvafjj)
  • The first of each pair is MathML, the second is MathJax. In this screenshot they look identical. In the live post that I'm viewing locally, the only difference is that if I press refresh the MathJax versions momentarily turn back to raw MathJax, whereas the MathML stays as mathematical notation. The raw MathML never shows, even on a slow connection, in the same way that raw HTML never shows, even on a slow connection.
  • <details>
  • <summary>The MathML and MathJax used to produce this screenshot</summary>
  • ```text
  • A fraction inline in the middle of a sentence <math>
  • <mfrac>
  • <mrow>
  • <mn>1</mn>
  • <mo>+</mo>
  • <mn>4</mn>
  • </mrow>
  • <mn>23</mn>
  • </mfrac>
  • </math> as an example.
  • A fraction inline in the middle of a sentence $\frac{1+4}{23}$ as an example.
  • A fraction on its own line:
  • <math display="block">
  • <mfrac>
  • <mrow>
  • <mn>1</mn>
  • <mo>+</mo>
  • <mn>4</mn>
  • </mrow>
  • <mn>23</mn>
  • </mfrac>
  • </math>
  • A fraction on its own line:
  • $$\frac{1+4}{23}$$
  • ```
  • </details>
  • [^1]: To be useful, we'd also need the tags that are used inside a `<math>` tag, such as `<mn>`, `<mo>`, `<mfrac>`, `<mrow>`, but this is still just a matter of adding them to the list of allowed tags. To allow mathematical notation on its own line (rather than inline in a sentence) we'd also need to add 'display' to the list of allowed attributes, to allow `<math display="block">`, but that's the full extent of the changes I needed to make to get this working in my local development environment - simply adding names to 2 lists.
  • ## Allow use of the `<math>` tag directly
  • Whether we convert MathJax to MathML behind the scenes or not, users should be able to directly add `<math>` tags to their posts.
  • We currently allow both Markdown and HTML in posts. Markdown has the advantages of being quicker to write and easier to read when not rendered (such as during editing). HTML has the advantage of allowing some things that are not possible in Markdown, such as collapsible hidden sections using a `<details>` tag.
  • Similarly, I'd like to see both MathJax and MathML allowed in posts. MathJax has the advantages of being quicker to write and easier to read when not rendered. MathML has the advantages of rendering faster and not requiring JavaScript to be enabled.
  • ## Communities that do not have MathJax enabled
  • - For communities that already have MathJax, I'd like to see MathML available too.
  • - For communities that do not have MathJax, I'd still like to see MathML available.
  • Unlike MathJax, which slows down page loading and increases data usage due to the extra JavaScript that must be loaded, MathML is built into the browser so enabling it will have no effect on loading time or data usage. I see no reason to have a community-specific switch for MathML. We can simply stop blocking it, and let the browser handle it automatically.
  • ## MathML is straightforward to enable
  • No code change is required to allow the use of a `<math>` tag in a post. All that is required is to add 'math' to the list of allowed tags[^1]. I've tested this in my local development environment. Here's a comparison of MathML then MathJax in a post:
  • > ![Fractions displayed with a horizontal bar, inline in a sentence and on a separate line slightly larger](https://meta.codidact.com/uploads/jhpun9es6hk1dlz9aqpnl3vvafjj)
  • The first of each pair is MathML, the second is MathJax. In this screenshot they look identical. In the live post that I'm viewing locally, the only difference is that if I press refresh the MathJax versions momentarily turn back to raw MathJax, whereas the MathML stays as mathematical notation. The raw MathML never shows, even on a slow connection, in the same way that raw HTML never shows, even on a slow connection.
  • <details>
  • <summary>The MathML and MathJax used to produce this screenshot</summary>
  • ```text
  • A fraction inline in the middle of a sentence <math>
  • <mfrac>
  • <mrow>
  • <mn>1</mn>
  • <mo>+</mo>
  • <mn>4</mn>
  • </mrow>
  • <mn>23</mn>
  • </mfrac>
  • </math> as an example.
  • A fraction inline in the middle of a sentence $\frac{1+4}{23}$ as an example.
  • A fraction on its own line:
  • <math display="block">
  • <mfrac>
  • <mrow>
  • <mn>1</mn>
  • <mo>+</mo>
  • <mn>4</mn>
  • </mrow>
  • <mn>23</mn>
  • </mfrac>
  • </math>
  • A fraction on its own line:
  • $$\frac{1+4}{23}$$
  • ```
  • </details>
  • [^1]: To be useful, we'd also need the tags that are used inside a `<math>` tag, such as `<mn>`, `<mo>`, `<mfrac>`, `<mrow>`, but this is still just a matter of adding them to the list of allowed tags. To allow mathematical notation on its own line (rather than inline in a sentence) we'd also need to add 'display' to the list of allowed attributes, to allow `<math display="block">`, but that's the full extent of the changes I needed to make to get this working in my local development environment - simply adding names to 2 lists.
#2: Post edited by user avatar trichoplax‭ · 2025-04-06T06:35:05Z (about 1 month ago)
Mention communities that do not have MathJax
  • ## Allow use of the `<math>` tag directly
  • Whether we convert MathJax to MathML behind the scenes or not, users should be able to directly add `<math>` tags to their posts.
  • We currently allow both Markdown and HTML in posts. Markdown has the advantages of being quicker to write and easier to read when not rendered (such as during editing). HTML has the advantage of allowing some things that are not possible in Markdown, such as collapsible hidden sections using a `<details>` tag.
  • Similarly, I'd like to see both MathJax and MathML allowed in posts. MathJax has the advantages of being quicker to write and easier to read when not rendered. MathML has the advantages of rendering faster and not requiring JavaScript to be enabled.
  • ## This is straightforward to enable
  • No code change is required to allow the use of a `<math>` tag in a post. All that is required is to add 'math' to the list of allowed tags[^1]. I've tested this in my local development environment. Here's a comparison of MathML then MathJax in a post:
  • > ![Fractions displayed with a horizontal bar, inline in a sentence and on a separate line slightly larger](https://meta.codidact.com/uploads/jhpun9es6hk1dlz9aqpnl3vvafjj)
  • The first of each pair is MathML, the second is MathJax. In this screenshot they look identical. In the live post that I'm viewing locally, the only difference is that if I press refresh the MathJax versions momentarily turn back to raw MathJax, whereas the MathML stays as mathematical notation. The raw MathML never shows, even on a slow connection, in the same way that raw HTML never shows, even on a slow connection.
  • <details>
  • <summary>The MathML and MathJax used to produce this screenshot</summary>
  • ```text
  • A fraction inline in the middle of a sentence <math>
  • <mfrac>
  • <mrow>
  • <mn>1</mn>
  • <mo>+</mo>
  • <mn>4</mn>
  • </mrow>
  • <mn>23</mn>
  • </mfrac>
  • </math> as an example.
  • A fraction inline in the middle of a sentence $\frac{1+4}{23}$ as an example.
  • A fraction on its own line:
  • <math display="block">
  • <mfrac>
  • <mrow>
  • <mn>1</mn>
  • <mo>+</mo>
  • <mn>4</mn>
  • </mrow>
  • <mn>23</mn>
  • </mfrac>
  • </math>
  • A fraction on its own line:
  • $$\frac{1+4}{23}$$
  • ```
  • </details>
  • [^1]: To be useful, we'd also need the tags that are used inside a `<math>` tag, such as `<mn>`, `<mo>`, `<mfrac>`, `<mrow>`, but this is still just a matter of adding them to the list of allowed tags. To allow mathematical notation on its own line (rather than inline in a sentence) we'd also need to add 'display' to the list of allowed attributes, to allow `<math display="block">`, but that's the full extent of the changes I needed to make to get this working in my local development environment - simply adding names to 2 lists.
  • ## Allow use of the `<math>` tag directly
  • Whether we convert MathJax to MathML behind the scenes or not, users should be able to directly add `<math>` tags to their posts.
  • We currently allow both Markdown and HTML in posts. Markdown has the advantages of being quicker to write and easier to read when not rendered (such as during editing). HTML has the advantage of allowing some things that are not possible in Markdown, such as collapsible hidden sections using a `<details>` tag.
  • Similarly, I'd like to see both MathJax and MathML allowed in posts. MathJax has the advantages of being quicker to write and easier to read when not rendered. MathML has the advantages of rendering faster and not requiring JavaScript to be enabled.
  • ## Communities that do not have MathJax enabled
  • - For communities that already have MathJax, I'd like to see MathML available too.
  • - For communities that do not have MathJax, I'd still like to see MathML available.
  • Unlike MathJax, which slows down page loading and increases data usage due to the extra JavaScript that must be loaded, MathML is built into the browser so enabling it will have no effect on loading time or data usage. I see no reason to have a community-specific switch for MathML. We can simply stop blocking it, and let the browser handle it automatically.
  • ## This is straightforward to enable
  • No code change is required to allow the use of a `<math>` tag in a post. All that is required is to add 'math' to the list of allowed tags[^1]. I've tested this in my local development environment. Here's a comparison of MathML then MathJax in a post:
  • > ![Fractions displayed with a horizontal bar, inline in a sentence and on a separate line slightly larger](https://meta.codidact.com/uploads/jhpun9es6hk1dlz9aqpnl3vvafjj)
  • The first of each pair is MathML, the second is MathJax. In this screenshot they look identical. In the live post that I'm viewing locally, the only difference is that if I press refresh the MathJax versions momentarily turn back to raw MathJax, whereas the MathML stays as mathematical notation. The raw MathML never shows, even on a slow connection, in the same way that raw HTML never shows, even on a slow connection.
  • <details>
  • <summary>The MathML and MathJax used to produce this screenshot</summary>
  • ```text
  • A fraction inline in the middle of a sentence <math>
  • <mfrac>
  • <mrow>
  • <mn>1</mn>
  • <mo>+</mo>
  • <mn>4</mn>
  • </mrow>
  • <mn>23</mn>
  • </mfrac>
  • </math> as an example.
  • A fraction inline in the middle of a sentence $\frac{1+4}{23}$ as an example.
  • A fraction on its own line:
  • <math display="block">
  • <mfrac>
  • <mrow>
  • <mn>1</mn>
  • <mo>+</mo>
  • <mn>4</mn>
  • </mrow>
  • <mn>23</mn>
  • </mfrac>
  • </math>
  • A fraction on its own line:
  • $$\frac{1+4}{23}$$
  • ```
  • </details>
  • [^1]: To be useful, we'd also need the tags that are used inside a `<math>` tag, such as `<mn>`, `<mo>`, `<mfrac>`, `<mrow>`, but this is still just a matter of adding them to the list of allowed tags. To allow mathematical notation on its own line (rather than inline in a sentence) we'd also need to add 'display' to the list of allowed attributes, to allow `<math display="block">`, but that's the full extent of the changes I needed to make to get this working in my local development environment - simply adding names to 2 lists.
#1: Initial revision by user avatar trichoplax‭ · 2025-04-06T06:20:00Z (about 1 month ago)
## Allow use of the `<math>` tag directly
Whether we convert MathJax to MathML behind the scenes or not, users should be able to directly add `<math>` tags to their posts.

We currently allow both Markdown and HTML in posts. Markdown has the advantages of being quicker to write and easier to read when not rendered (such as during editing). HTML has the advantage of allowing some things that are not possible in Markdown, such as collapsible hidden sections using a `<details>` tag.

Similarly, I'd like to see both MathJax and MathML allowed in posts. MathJax has the advantages of being quicker to write and easier to read when not rendered. MathML has the advantages of rendering faster and not requiring JavaScript to be enabled.

## This is straightforward to enable
No code change is required to allow the use of a `<math>` tag in a post. All that is required is to add 'math' to the list of allowed tags[^1]. I've tested this in my local development environment. Here's a comparison of MathML then MathJax in a post:

> ![Fractions displayed with a horizontal bar, inline in a sentence and on a separate line slightly larger](https://meta.codidact.com/uploads/jhpun9es6hk1dlz9aqpnl3vvafjj)

The first of each pair is MathML, the second is MathJax. In this screenshot they look identical. In the live post that I'm viewing locally, the only difference is that if I press refresh the MathJax versions momentarily turn back to raw MathJax, whereas the MathML stays as mathematical notation. The raw MathML never shows, even on a slow connection, in the same way that raw HTML never shows, even on a slow connection.

<details>
<summary>The MathML and MathJax used to produce this screenshot</summary>

```text
A fraction inline in the middle of a sentence <math>
  <mfrac>
    <mrow>
      <mn>1</mn>
      <mo>+</mo>
      <mn>4</mn>
    </mrow>
    <mn>23</mn>
  </mfrac>
</math> as an example.

A fraction inline in the middle of a sentence $\frac{1+4}{23}$ as an example.

A fraction on its own line:
<math display="block">
  <mfrac>
    <mrow>
      <mn>1</mn>
      <mo>+</mo>
      <mn>4</mn>
    </mrow>
    <mn>23</mn>
  </mfrac>
</math>

A fraction on its own line:
$$\frac{1+4}{23}$$
```
</details>

[^1]: To be useful, we'd also need the tags that are used inside a `<math>` tag, such as `<mn>`, `<mo>`, `<mfrac>`, `<mrow>`, but this is still just a matter of adding them to the list of allowed tags. To allow mathematical notation on its own line (rather than inline in a sentence) we'd also need to add 'display' to the list of allowed attributes, to allow `<math display="block">`, but that's the full extent of the changes I needed to make to get this working in my local development environment - simply adding names to 2 lists.