Open ntjess opened 5 months ago
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?
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:
There is a somewhat complicated template loading procedure so I'm not sure how helpful I could be...
delimiters
block if latex is disabled?
delimiters
property to markdown so it can listen for re-enabling later?
Consider the following string:
Solara renders this as:
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:
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.