Open lluni opened 1 year ago
Agree. Inline math formatting and rendering support are very important.
Will this issue ever be updated?
Hi @zefhemel -- I think this and #4 are essentially asking for inline rendering of math, which in my experience is going to be needed by anybody who needs math.
In other words: I could be wrong, but a plugin that only does display (=paragraph) math is not useful for the vast majority of the math-using audience.
The architectural question is: is it possible to extend inline styles with the plugin mechanism, or does it require deeper changes in silverbullet?
Thank you so much for bringing silverbullet to the world!
Yes, I agree and this does indeed make things significantly harder. This cannot be done with a plug and requires extending the existing markdown parser built into SilverBullet.
I had a quick search. Since I am unfamiliar with all of Lezer, TS and KaTeX/Mathjax, I really hope these hits are relevant and help in to make math typesetting fully supported in silverbullet: it is such an central use-case for many students, scientists and engineers!
$ $
and $$ $$
-delimited strings for code highlighting, with codeYes those seem relevant. What makes this harder though is that the $bla
syntax is already in use for anchors: https://silverbullet.md/Markdown/Anchors so somehow the parser would have to be able to disambiguate between $someFormula$
being parsed as a LaTeX formula and an anchor ending with a $
. Perhaps forcing to put spaces around would be acceptable ($ someFormula $
)?
Yes, that is unfortunate.
If it were up to my sole personal preference (others should chip in!) I'd rather disallow anchors ending with $
(this seems not too unreasonable given the semantics of $
as currency unit?)
Typing formulas is already quite cumbersome, so it'd be nice if it could be as efficient as possible. (Asciimath is a thing, but I think there's no way around the more verbose LaTeX syntax in terms of mindshare.)
For display math, it would be great if the conventional $$ ... $$
(with or without extra spaces, as you may decide) could be adopted. It rolls somewhat better off the fingers than the current latex block, which could be the syntax for syntax-highlighted (La)TeX code.
What do you think?
This discussion reminded me of the extensible markdown language designed for Pharo Smalltalk, Microdown (pdf paper). One of their highlights is that they provide for labeled equations, i.e. equations with anchors. Considering this scenario where the two syntaxes interact might help find a way forward.
Their approach to anchors makes it possible to link to figures, and to parameterize code. One of their design goals was for Microdown to remain a subset of Markdown.
Concretely, this how they do math support in microdown.
Something to highlight is that their @anchor
is a block element, i.e. must stand on its own line, unlike $anchor
in silverbullet.
Something I had not considered above is how $
doubling down for anchors and the start of inline math impacts the editing experience. I can think of two aspects to consider:
$f
will start rendering greyed out as an anchor and then be interpreted as a formula upon closing of $f
with (x)=x^2$
. This might be slightly unexpected.$\sum_{i} ...
the Σ renders upon typing _
then the subindex on closing with }
, etc. )Just chipping in, could an inline code block work, like pandoc's `x = 4`{.ruby}?
In for example Logseq or Obsidian it is possible to surround a given text with
$
/$$
to render the text inline/multi-line (kind of like the current option with the LaTeX code block, but usually centered likealign*
/equation*
if not specified otherwise) respectively.This would make it faster and simpler to write LaTeX as there wouldn't be as much overhead to make a code block anymore.