Update htmlcdparser.py#19
Open
7MS8 wants to merge 5 commits into
Open
Conversation
Fix: hr tag blocking subsequent tags + LaTeX/KaTeX rendering Removed hr from beg/end dicts – it was setting inside_tag="hr" and blocking all following tags Added inline LaTeX rendering: KaTeX <annotation> tags are parsed for raw LaTeX source and rendered to PNG via latex/dvipng Added NFC Unicode normalization to fix Umlaut parsing (ä, ö, ü) Added re.MULTILINE to line-start regex patterns Added escaping for 5+ dash sequences (Zim horizontal rule syntax)
mathml to png for copilot
latex font conf
added dependency description
cetinkaya
reviewed
Jun 11, 2026
| if loglines is not None: | ||
| loglines.append(str(msg)) | ||
|
|
||
| def _show_debug_terminal(lines): |
Owner
There was a problem hiding this comment.
Not all operating systems have /tmp folder. Is there another way to show the debug log?
cetinkaya
reviewed
Jun 11, 2026
| "tr": "", | ||
| "th": "|", | ||
| "td": "|", | ||
| "hr": "-----\n", |
Owner
There was a problem hiding this comment.
This doesn't seem to be related to latex.
cetinkaya
reviewed
Jun 11, 2026
| return | ||
| if tag == "blockquote": | ||
| self.inside_blockquote = True | ||
| #If the tag a is in a non-nestable one, tag a prevails and the previous one is deleted. In block sentences it is not done |
Owner
There was a problem hiding this comment.
Is it possible to keep the comments and existing code for parsing html?
cetinkaya
reviewed
Jun 11, 2026
| #end of nestable tag | ||
| if self.inside_tag == tag: | ||
| self.inside_tag = ""; | ||
| #Init href of tag a |
Owner
There was a problem hiding this comment.
Is it possible to keep these comments?
cetinkaya
reviewed
Jun 11, 2026
| return | ||
| if tag == "blockquote": | ||
| self.inside_blockquote = False | ||
| #end of nestable tag |
Owner
There was a problem hiding this comment.
Is it possible to keep these comments?
Owner
|
This is perhaps a useful functionality, but too many parts of the code are being changed at once. Please let me take some time to review the code and test. |
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.
Add KaTeX/LaTeX equation rendering
When pasting from Claude.ai or copilot or other sites that use KaTeX, LaTeX equations are now automatically rendered to PNG and embedded as images in Zim.
How it works: the parser detects tags inside KaTeX HTML, extracts the raw LaTeX source, and renders it to PNG via latex/dvipng (the same tools used by Zim's built-in Equation Editor plugin). The PNG is saved to the page's attachments folder and embedded as {{./eq_....png}}.
Requirements: latex and dvipng must be installed (same dependency as Zim's Equation Editor plugin).
Also included: a few minor fixes (hr tag parsing, Umlaut normalization, regex multiline flags, dash escaping).
Fix: hr tag blocking subsequent tags + LaTeX/KaTeX rendering
Removed hr from beg/end dicts – it was setting inside_tag="hr" and blocking all following tags Added inline LaTeX rendering: KaTeX tags are parsed for raw LaTeX source and rendered to PNG via latex/dvipng Added NFC Unicode normalization to fix Umlaut parsing (ä, ö, ü) Added re.MULTILINE to line-start regex patterns
Added escaping for 5+ dash sequences (Zim horizontal rule syntax)