Repository navigation
Render math formulas (KaTeX/TeX) in the native reader #2379
xihale
started this conversation in
Feature Requests
Replies: 1 comment
|
Interesting problem - thanks for the bug report. Let me think about how to approach this. I'm tracking it here: #2387 |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Problem
Math-heavy sites (Astro/Hugo blogs, physics/CS blogs) render formulas with KaTeX,
which arrives in the RSS/full-content HTML as
span.katexmarkup with the raw TeXin a MathML annotation. The native reader currently shows this as mangled TeX
source text mixed into paragraphs, e.g.
F_0 = 0, F_1 = 1, F_{n+1}...and\begin{pmatrix}...\end{pmatrix}instead of the formula.Proposal
Parse KaTeX spans during linearization and render the extracted TeX locally with
jlatexmath (
ru.noties:jlatexmath-android, pure JVM, no WebView, no network):InlineTextContent, scaled with the reader font size(
\label,\tag,\nonumber...) scrubbed before parseI have a working implementation on a branch. Screenshot from a math-heavy
article (dark theme, phone):
Notes for review
repo's GPL-3.0 (used as GPL-3.0).
(jlatexmath resolves macros reflectively; without keep rules minified
builds crash on any formula using
\frac,\sum,\sqrt, matrices, etc).\color/\bm) fall back toshowing the TeX source in monospace, so nothing crashes.
The branch is ready against upstream/main — happy to open a PR.
All reactions