Skip to content

Allow escaped characters to be used inside markdown math

Brett Walker requested to merge 373162-allow-escaped-chars-markdown-math into master

What does this MR do and why?

Certain characters, such as $, %, #, &, {, }, and _, must be escaped when used in LaTeX math blocks (https://katex.org/docs/support_table.html#symbols). This MR just targets the ones listed above. Additional support will be added with #387585

In addition, the handling of the $$/n.../n$$ syntax before passing it to markdown fixes a variety problems for those math blocks.

How to set up and validate locally

  1. Visit an issue, and either edit the description or add a comment

  2. Add

    $1 \& \$2$
  3. When previewing, you should see Screenshot_2023-01-09_at_3.01.17_PM

  4. Add

    $$
    \dot{X} = \bold{\frac{A}{\rho B}}_{\text{first term}} + \bold{\frac{C (D - E)}{F \gamma}}_{\text{second term}} + \bold{\frac{h_{i} (J_{k} - L)}{M_{\lambda}} }_{\text{third term}}
    $$

    Screenshot_2023-01-09_at_5.15.35_PM

  5. Add

    $$
    \dot{X} = \underbrace{\frac{A}{\rho B}}_{\text{first term}} + \underbrace{\frac{C (D - E)}{F \gamma}}_{\text{second term}} + \underbrace{\frac{h_{i} (J_{k} - L)}{M_{\lambda}} }_{\text{third term}}
    $$

    Screenshot_2023-01-09_at_5.17.20_PM

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #373162 (closed)

Edited by Brett Walker

Merge request reports

Loading