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

Feature request: optionally disable katex in markdown #698

Open
ntjess opened this issue Jun 30, 2024 · 2 comments
Open

Feature request: optionally disable katex in markdown #698

ntjess opened this issue Jun 30, 2024 · 2 comments

Comments

@ntjess
Copy link

ntjess commented Jun 30, 2024

Consider the following string:

We made $4500 and then $4600 the next month

Solara renders this as:
image

We can manually escape $ ahead of time, but it is a complex procedure. Only pairs of $ render as math, and double-$$ pairs on their own lines. Ideally, we can just disable math output if we know it doesn't apply.

Also, since VSCode doesn't render math text anyway, this escaping produces visible backslashes in that environment:
image

Edit: Escaped dollars show their backslashes in the browser too. So it seems there is no way to properly render the sentence above in markdown?

So it seems the only way to get a uniform behavior is to allow users to disable math mode in browser.

@ntjess ntjess changed the title Feature request: disable katex in markdown Jun 30, 2024
@iisakkirotko
Copy link
Collaborator

iisakkirotko commented Jul 2, 2024

Hey @ntjess!

Seems that $\$$ can be used to escape this trap. Note that this renders $ in mathematics mode, which will differ from any $ outside.

Either way, I think it would be nice to have a better way to mitigate this issue. I think the most optimal way to implement this would be to allow the user to determine which delimiters they wish to use for math rendering. What do you think of this approach? Would you like to open a PR for this, or should I take a look?

@ntjess
Copy link
Author

ntjess commented Jul 2, 2024

Great idea, it somehow hadn't crossed my mind 😅 It solves the issue in solara run and jupyter notebook, but still shows raw characters in the vscode notebook preview:
image

There is a somewhat complicated template loading procedure so I'm not sure how helpful I could be...

  • Do we avoid loading katex entirely if latex is disabled?
  • Alternatively, do we just delete the delimiters block if latex is disabled?
    • Do we add a delimiters property to markdown so it can listen for re-enabling later?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants