[feat] MFM, see if we can use Latex input #828
Labels
No labels
approved, awaiting change
bug
configuration
documentation
duplicate
enhancement
extremely low priority
feature request
Fix it yourself
help wanted
invalid
mastodon_api
needs docs
needs tests
not a bug
planned
pleroma_api
privacy
question
static_fe
triage
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: AkkomaGang/akkoma#828
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The idea
For Markdown parser, we use Earmark. Earmark uses EarmarkParser. EarmarkParser turns the Markdown string into a tree, Earmark then turns that tree into HTML.
I noticed that there's a (default
false
)math
option in EarmarkParser, https://github.com/RobertDober/earmark_parser/tree/master?tab=readme-ov-file#mathematical-expressionsI haven't tried yet, and I'm unsure if Earmark can handle it properly. But if it can turn latex into FEP-dc88 compliant HTML, and in a way that's compatible with MFM, then we could use this and don't even need extra dependencies. Note, however, that there is currently a warning "math syntax within Markdown is not standardized, so this option is a subject to change in future releases".
Related:
The reasoning
MFM is one the the features that sets Akkoma apart from the other non-*key implementations, and I assume general something Akko people like to have. Having proper Latex (Katex) support could bring us closer to feature parity, and compatibility, with *key implementations like e.g. Foundkey.
Have you searched for this feature request?
documenting remarks from IRC:
atm earmark only puts math in a
<code>
block (with a special class) to a avoid e.g.*
and_
s in math getting interpreted as Markdown markup mangling the output.It also uses TeX-style
$inline math$
and$$math block$$
instead of LaTeX-style\(inline math\)
and\[math block\]
like MFM.We could tape our own pre and postprocessing on to workaround this, but upstreaming at least some changes would be ideal. E.g. if earmark doesn’t want to pull in a dependency for or itself implement MathML it could let users configure callbacks for transforming math markup into a HTML node defaulting to the current
<code>
node if unspecified.