Skip to content

[FindTeX] Parsing error with inline text nodes #78

@ian-r-rose

Description

@ian-r-rose

This is a bit subtle, and I am not entirely sure I have diagnosed the problem correctly, but I am running into a bug in the findMath() function in MathJax3. It appears that having nested elements in a paragraph (for instance, using the <strong> tag) causes premature exiting of the DOM string parser. Here is a minimal example, based upon the mj3-tex2html.html demo:
An HTML document with the following fails:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>Testing MathJax v3 setup with TeX input</title>
  <script src="https://cdn.polyfill.io/v2/polyfill.min.js"></script>
  <script src="mj3-tex2html.dist.js"></script>
</head>
<body>
    <p>This is a <strong>spoiler</strong></p>
    <p>
    $$ E = mc^2 $$
    </p>
</body>
</html>

Producing
image

Whereas the following succeeds:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>Testing MathJax v3 setup with TeX input</title>
  <script src="https://cdn.polyfill.io/v2/polyfill.min.js"></script>
  <script src="mj3-tex2html.dist.js"></script>
</head>
<body>
    <p><strong>A spoiler</strong>, this ain't</p>
    <p>
    $$ E = mc^2 $$
    </p>
</body>
</html>

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions