Closed Ir1d closed 4 years ago
While supporting this wouldn’t be too hard to implement (although brittle: the backslashes, parens, and square brackets will interfere with other Markdown constructs, whereas dollars are not in use), I’m not really in favor of adding it: I prefer that remark (and other markdown parsers) push a single way to do things. Having multiple ways to do a similar extension makes the Markdown you write less portable.
I totally agree with you. Lets stick with $
and $$
If someone wants this btw, packages/remark-math
can be forked to add that. rehype-katex
and such will still work if you expose the same math node in Markdown!
yeah I understand, that's nice. I believe using $
only will be better, even though it takes more time to migrate, it's worth the effort.
I (a person on the internet) disagree with this decision.
Using \(
is not a config option, it's part of LaTeX syntax and is actually ENCOURAGED: https://tex.stackexchange.com/questions/510/are-and-preferable-to-dollar-signs-for-math-mode.
I understand that TeX !== LaTeX but it still feels like a thing that should be supported.
We’re not necessarily covering (la)tex here though: it’s about math in markdown in general, which could be mathml or asciimath syntax too.
And, see https://github.com/remarkjs/remark-math/issues/39#issuecomment-612572749: you can do this yourself if you want to!
I don't feel like users should have to fork the project to be able to do this. Is it really that complex to implement here? It seems like it's not (but I might be mistaken).
@travigd there's a fine line here. Adding configuration for markers may have value to discuss on it's own.
The push back is on reason presented, which appears to be "it's in latex, so it should be here". That is a non-goal, markdown is not latex.
If you want a latex transformer, contributions towards https://github.com/syntax-tree/ideas/issues/6 are welcome! If there is a markdown focused reason, it may be worth exploring.
Sure, sure, I get it.
From my perspective, I'm just trying to give the best experience possible to the users of my editor (users who are at least partially accustomed to the \(
syntax). I'm not arguing that this project should support all things LaTeX (e.g., supporting \begin{align}
), but I am arguing that supporting \(
is a very pragmatic thing to do.
I don’t think it’d be good for markdown to standardize several syntaxes. I think we’re in a position to push for one syntax, as the most popular markdown parser, and I think we should do that. Again: you can do whatever you want with plugins, but I don‘t think we should make it easier.
If someone wants this btw, packages/remark-math can be forked to add that. rehype-katex and such will still work if you expose the same math node in Markdown!
Can you give some examples on how to do this exactly? Looking at the package code, I'm a little lost albeit I haven't made my own plugin before.
@danny-avila see the guide to plugins and ASTs at https://unifiedjs.com/learn/ And extending the parser at https://github.com/micromark/micromark#creating-a-micromark-extension
@wooorm It looks like OpenAI has decided to use the bracket syntax for its formulas:
https://chat.congusto.ai/public/9834ffd8-e15b-4d4f-83ad-057038e9239d (you can toggle md for the message)
Is there any chance you could reconsider the WONTFIX?
https://chat.congusto.ai/public/9834ffd8-e15b-4d4f-83ad-057038e9239d (you can toggle md for the message)
@xl0 did you share the right example? The one you shared uses $ which is already supported.
Is there any chance you could reconsider the WONTFIX?
Not at this time, and not for LLMs. LLMs are masters of formatting things. If your LLM of choice uses non-standard markdown by default, prompt it to use standard markdown 🙂
@ChristianMurphy, yes:
<prompt>Demonstrate the use of math in markdown</prompt>
<d>easy</d>
You can use LaTeX syntax for math in Markdown, typically supported by platforms like GitHub, Jupyter, or Markdown processors with math support.
Inline math:
`$E = mc^2$` renders as \( E = mc^2 \).
Block math:
\```
$$
\int_0^1 x^2 \, dx = \frac{1}{3}
$$
\```
renders as:
\[
\int_0^1 x^2 \, dx = \frac{1}{3}
\]
So it uses the $$ syntax in the example, but then uses the [ ( syntax actually to render the formulas.
I'm not saying, handle it by default, but an option would be great. I kind of see why they chose this style - it's less ambiguous. If it was just any LLM provider, I would not bother, but OpenAI kind of sets the tone for the ecosystem.
It is recommending humans to use $
though?
Subject of the feature
Describe your issue here.
in some mathjax configs people write
\(a+b\)
as formulas, will this be supported?Problem
If the feature requests relates to a problem, please describe the problem you are trying to solve here.
Expected behaviour
What should happen? Please describe the desired behaviour.
parse
\(\)
as inline and\[\]
as dispayAlternatives
What are the alternative solutions? Please describe what else you have considered?
possible related #21