Render TeX math spans via JLaTeXMath#7
Merged
Merged
Conversation
Recognize $…$ / \(…\) (inline) and $$…$$ / \[…\] (display) math in text runs when HtmlRenderOptions#renderMath is enabled, and typeset them with JLaTeXMath into baseline-aligned image nodes — falling back to the source text when the TeX does not parse. Delimiter recognition follows Pandoc's heuristics (currency like "$5 and $10" stays text; code, links and <pre> are never scanned); an escaped \$ is a literal dollar. jlatexmath ships no module descriptor and splits its optional fonts into resource-only companion jars, so it is turned into one proper module (fonts merged in) via the extra-java-module-info Gradle plugin, matching JabRef's own build. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This was referenced Jul 7, 2026
koppor
added a commit
that referenced
this pull request
Jul 7, 2026
The click handler resolves a link via getStyleAttributeMap(...).get(HREF). Node segments (embedded images, tables) have no character attributes, so the model returns a null attribute map at their position — clicking a book-cover image therefore lands on a null map. The inline guard added in #7 already tolerates this; extracting it into a public hrefAt(model, position) helper makes the guard unit-testable without the JavaFX toolkit and gives callers that install their own click handler a supported way to resolve the target at a position. Adds headless regression tests: hrefAt returns null (no throw) at an inline image's position, and still resolves the target for a real link run. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Siedlerchr
added a commit
that referenced
this pull request
Jul 8, 2026
This reverts commit 4ec2303.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds TeX math rendering to html-to-node. When
HtmlRenderOptions.renderMathis enabled,$…$/\(…\)(inline) and$$…$$/\[…\](display) spans in text runs are recognized and typeset with JLaTeXMath into baseline-aligned, color-matched image nodes; unparseable TeX falls back to its verbatim source.Details
MathSegmentersplits math out of the parsed model using Pandoc's delimiter heuristics (currency like$5 and $10stays text;\$is a literal dollar; code, links and<pre>are never scanned).MathRenderingrasterizes via JLaTeXMath (2× supersampling for glyph quality) and tracks the surrounding text color through thehtml-textCSS class.FxRenderer,RichTextRenderer),PlainText(round-trips the source for copy), andBlockCollector.extra-java-module-infoplugin — the same approach JabRef's own build uses.Tests
MathSegmenterTest(headless): delimiters, Pandoc heuristics,\$escaping, code/link exclusion, plain-text round-trip,isRenderable.MathRenderingTest(gui): real end-to-end rendering plus the unparseable-TeX fallback.All existing tests pass.
🤖 Generated with Claude Code