-
Notifications
You must be signed in to change notification settings - Fork 3
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: Math support #23
Conversation
80754ff
to
deee15a
Compare
-- and must not be followed immediately by a digit. | ||
-- NOTE: For display math, "there can be no blank lines between the opening and closing $$ delimiters", | ||
-- Does this implies blank lines are acceptable in inline math? For now, assume it's not the case, | ||
-- and not even a line break (which would be allowed in $$ per the above) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unless I got it wrong, Github doesn't accept a line break in inline math... So $e^{i\pi}$
is
$e^{i\pi}
= -1$
Is not parsed as math:
$e^{i\pi}
= -1$
Pandoc seems to differ here: accepts a line break, but seems to have the same restriction as display math (= no blank lines). Really, folks? This does not seem in line with what the manual says...
larsers.displaymathdelim = parsers.dollar * parsers.dollar | ||
larsers.displaymath = larsers.displaymathdelim | ||
-- There can be no blank lines between the opening and closing $$ delimiters. | ||
* C((parsers.any -parsers.blankline^2 -parsers.dollar -larsers.displaymathdelim)^1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pandoc accept a single $
in display math: $$ e = $x $$
is $$ e =
So my -parsers.dollar
is probably wrong here.
But GitHub doesn't $$ e = $x $$
is:
$$ e =
(And some say Markdown is simple. Folks you got mad at one point ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Scrap that. Both Pandoc and Github do not seem to accept a single $ in display math (or behave badly, but differently however ! Oh my...)
specials = specials .. "'\"" | ||
end | ||
if options.tex_math_dollars then | ||
specials = specials .. "$" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whether we should make $
escapable is another thing that is unclear to me...
@@ -890,11 +891,14 @@ function M.new(writer, options) | |||
-- Basic parsers (local) | |||
------------------------------------------------------------------------------ | |||
|
|||
local specials = "*_~`&[]<!\\-@^" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Aside node) If going this route, we should perhaps fix the changes made for superscripts and subscripts the same way, to avoid having the added characters being interpreted as "specials" when the corresponding extensions are disabled.
examples/sile-and-markdown.md
Outdated
There is an important constraint, though: you have to restrict yourself to the syntax subset supported | ||
by SILE. This being said, some nice fomulas may be achieved: | ||
|
||
$$\pi=\sum_{k=0}^\infty\frac{1}{16^k}(\frac{4}{8k+1} \minus \frac{2}{8k+4} \minus \frac{1}{8k+5} \minus \frac{1}{8k+6})$$ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Aside note) Check the example... GitHub accepts it, but complains - \minus
doesn't seem legit:
I'm bad at TeX math :p Pandoc to HTML complains ("Could not convert TeX math"), even with -
instead of that \minus
(which SILE accepts, it but might be by mere chance lol)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
N.B. Also relates to sile-typesetter/sile#1642 on the SILE side...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GitHub accepts the minus sign (−):
Due to the above-mentioned SILE behavior with unary/binary operators, I'll stick to it for now (I don't think it will be fixed in a decent time-frame)
I will review this in February as part of Witiko/markdown#216 if that's OK. |
deee15a
to
ebfcbb2
Compare
Just rebased and conflicts fixed, for now.
No problem at all, you are welcome. |
ebfcbb2
to
e0021bf
Compare
Close #20