GFM elements (strikethrough, tables, alerts, bare autolinks) crash the LatexRenderer with NotImplementedError
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 25/100
Research direction
Start with the GFM renderer mixin, which registers render_strikethrough, the table renderers, render_alert and render_url only for the HTML and Markdown renderers, and with the LatexRenderer in marko/ext/latex_renderer. Reproduce with the snippet in the issue to confirm the NotImplementedError from helpers.super_render. Pull request #298 is already open against this issue, so check it before starting. Done means all four element types render to LaTeX without raising.
Written by the indexing model from the issue text.
Description
GFM elements crash the LatexRenderer with an opaque NotImplementedError
What happens
LatexRenderer is documented in docs/extend.rst ("renders elements as LaTeX document"), but combining it with the GFM extension crashes for four of the extension's element types instead of rendering: strikethrough, tables, alerts, and bare autolinks all raise
NotImplementedError: Unsupported renderer <class 'marko._Renderer'>
Repro on current master (2.2.5, system Python 3.13):
from marko import Markdown
from marko.ext.latex_renderer import LatexRenderer
md = Markdown(renderer=LatexRenderer, extensions=["gfm"])
for text in [
"~~struck~~",
"| a | b |\n|---|---|\n| 1 | 2 |\n",
"> [!NOTE]\n> content\n",
"visit http://example.com/x_y now\n",
]:
try:
md.convert(text)
except NotImplementedError as e:
print("CRASH:", text.splitlines()[0], "->", e)
Output:
CRASH: ~~struck~~ -> Unsupported renderer <class 'marko._Renderer'>
CRASH: | a | b | -> Unsupported renderer <class 'marko._Renderer'>
CRASH: > [!NOTE] -> Unsupported renderer <class 'marko._Renderer'>
CRASH: visit http://example.com/x_y now -> Unsupported renderer <class 'marko._Renderer'>
Why
The GFM renderer mixin registers render_strikethrough, render_table/render_table_row/render_table_cell, render_alert, and render_url only for the HTML and Markdown renderers, so with LatexRenderer the render_dispatch fallback (helpers.super_render) walks the MRO, finds no other implementation, and raises. The message naming marko._Renderer doesn't point at the missing element handler at all, and the exception kills the whole document conversion — one ~~word~~ anywhere in a file makes the entire LaTeX output unusable.
Inline HTML gets a logger.warning and renders as empty when unsupported; these four element types shouldn't be worse than that. Concrete suggestions, following the renderer's existing conventions:
~~x~~→\st{x}(soul package, the way emphasis already becomes\textit)- tables → a
tabularenvironment with\hlinearound the header, column spec from the delimiter row alignments [!NOTE]alerts → thedisplayquoteenvironment already used for quotes, prefixed with the alert type label- bare autolinks →
\url{dest}, exactly whatrender_auto_linkalready emits for<...>autolinks
Happy to put up a patch along these lines unless something is already in progress.
- Dominant language
- Python
- Stars
- 470
- Forks
- 72
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 34
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from frostming/marko
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Trailing spaces and tabs are preserved at the end of paragraphsPossibly taken @rahul05ranjan claimed this today. Open
Difficulty 3/5 1-2 days Newbie friendliness 25/100
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
frostming/marko#105 · 4 reactions ·
Maintainers usually reply within 1 day
Similar issues
-
AI bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
AUTO-MAS-Project/AUTO-MAS#1960 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
btclib-org/btclib-wallet#872 ·
Maintainers usually reply within 1 day
-
[Bug]: Scheduled returns scan all accepted minion keys causing extreme loadPossibly taken A pull request linked to this issue is open or already merged. Openbug needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
saltstack/salt#70789 · 1 comment ·
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 87/100
btclib-org/btclib#3093 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day