Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

latex rendering exception #237

Closed
5 tasks done
fisheryv opened this issue Jan 10, 2024 · 4 comments
Closed
5 tasks done

latex rendering exception #237

fisheryv opened this issue Jan 10, 2024 · 4 comments

Comments

@fisheryv
Copy link
Contributor

Describe the bug

The following latex
$P(x) = a_nx^n+a_{n-1}x^{n-1} + \dots + a_1x + a_0$
will be renderer as
$P(x) = a[objectObject],[objectObject],[objectObject]{n-1}x^{n-1} + \dots + a_1x + a_0$

I think this is caused by the latex parser parsing the content between underscores _..._ as emphasistext.

I will try to fix the problem.

Reproduction

$P(x) = a_nx^n+a_{n-1}x^{n-1} + \dots + a_1x + a_0$

System Info

System:
    OS: Linux 6.2 Ubuntu 22.04.3 LTS 22.04.3 LTS (Jammy Jellyfish)
    CPU: (2) x64 Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
    Memory: 2.28 GB / 7.76 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 20.10.0 - ~/.nvm/versions/node/v20.10.0/bin/node
    Yarn: 1.22.21 - ~/.nvm/versions/node/v20.10.0/bin/yarn
    npm: 10.2.5 - ~/.nvm/versions/node/v20.10.0/bin/npm
    pnpm: 8.12.1 - ~/.nvm/versions/node/v20.10.0/bin/pnpm

Used Package Manager

pnpm

Validations

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.
@fisheryv
Copy link
Contributor Author

One more thing, this problem only occurs in inline mode, display mode does not have this problem.

And it is sensitive to braces. Removing the braces between underscores can be rendered correctly.

@fisheryv
Copy link
Contributor Author

fisheryv commented Jan 12, 2024

Well, I think this is an issue with markdown-to-jsx.

I found the simplest way to solve the problem was removing the _ in the TEXT_EMPHASIZED_R regex, as follows

/^([*])((?:\[.*?\][([].*?[)\]]|<.*?>(?:.*?<.*?>)?|`.*?`|~+.*?~+|.)*?)\1(?!\1|\w)/

However, if I do so, markdown will not support using underline syntax _..._ for emphasis.

Any suggestions? @Innei

@Innei
Copy link
Owner

Innei commented Jan 12, 2024

Fixed, thank you

@Innei Innei closed this as completed in fd59a7a Jan 12, 2024
@fisheryv
Copy link
Contributor Author

Well done. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants