Closed SamyPesse closed 3 years ago
I modelled math after inline code, so escapes don’t work inside it, and spaces can be used to wrap just a single dollar, such as for $$ \$ $$
, in which case they are stripped. The same can we done with code: `` ` ``
.
So note that you can already use double dollars. Or more.
I also experienced the problem you have with financial data, so I think it’s fine to make this an option.
What name would you suggest?
Hi! This was marked as ready to be worked on! Note that while this is ready to be worked on, nothing is said about priority: it may take a while for this to be solved.
Is this something you can and want to work on?
Team: please use the area/*
(to describe the scope of the change), platform/*
(if this is related to a specific one), and semver/*
and type/*
labels to annotate this. If this is first-timers friendly, add good first issue
and if this could use help, add help wanted
.
I'm probably biased by my experience with math formula in markdown at GitBook, but I think it should be the default to use $$
for text since it's a safer default option ($$
works for all content, while $
can conflict with financial data)
(Before looking at your suggestions) a few names i think could work:
forceDoubleDollars
(default to false
for compatibility, until a breaking change and then default to true
)acceptSingleDollarInlines
(default to true
for compatibility, until a breaking change and then default to false
)(After looking at your suggestions) using "text" instead of inline makes sense 👍 I like singleDollarText
as an option, it's explicit and do not conflict with blocks.
Hmm, what do you think of singleDollarTextMath
?
singleDollarText: true
might sound to some as if single dollars would turn into text, but the actual result is the inverse.
singleDollarTextMath: true
sounds much more like what’s going to happen? 🤔
Perfect 🙌
Hi! This was closed. Team: If this was fixed, please add phase/solved
. Otherwise, please add one of the no/*
labels.
Released!
Initial checklist
Problem
Single dollars can easily conflict with financial data in a Markdown content.
For example the following markdown content will be parsed with an inline math node:
Solution
For GitBook, we've solved this problem in our custom markdown parser by also using
$$
for inline maths.It'd be great if
remark-math
could accept an option to use double dollars for inlines.Alternatives
An alternative could be to only parse inline maths if there is no spaces in it. But it'd not be a great UX for people writing markdown.
Ex: