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

feat: support math formula #1857

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

usoonees
Copy link

@usoonees usoonees commented Sep 24, 2024

fix: #1223 #1802

  1. add rehypeKatex plugin to support latex syntax.
  2. replace \(..\) and \[...\] to $...$ and $$...$$.

Due to remark-math only supporting the use of the $ symbol for inline math and $$ for block math (see discussion at: remarkjs/remark-math#39), we need to convert math notations from \(..\) to $...$ and from \[...\] to $$...$$ .

After:
Conversion result

Before
Appearance before conversion

@xl0
Copy link

xl0 commented Sep 24, 2024

@usoonees I tried this approach for my project, don't think this is the way to go, there are too many corner-cases.
I think we should write a replacement for remark-math / mdast-util-math to handle them properly.

@xl0
Copy link

xl0 commented Sep 24, 2024

For example:

  • LLMs that use the bracket syntax will not escape $ in text, so $100 to $200 will be seen as a formula.
  • LLMs will produce \[ ... \] without new lines, and use syntax that is only allowed in block math inside. This is parsed as inline math, and gives a rendering error.
  • Math inside
    • Deeply
      • Nested
        • Lists

requires special handling, as

      $$
      \formula
$$

is not handled correctly.

Another concern, this project is kinda dead, if you consider the number of open PRs and lack of action. I used to host chatbot-ui for myself and friends, but am now working on Congusto Chat, which will soon reach feature parity, and has an ambitious roadmap, including code interpreter and artefacts.

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

Successfully merging this pull request may close these issues.

Cannot convert inline math fomula
3 participants