Repository navigation
Register custom nodes for the Markdown builder - #885
Merged
mgeier merged 1 commit intoNov 8, 2026
Merged
Conversation
sphinx-markdown-builder (builder name "markdown") skips nodes without a registered handler, so code cells, info/warning boxes and galleries were dropped from its output with "unknown node type" warnings. Handle them like the text builder does, so their children are rendered.
Member
|
Thanks! |
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.
Fixes #859
CodeAreaNode,FancyOutputNode,AdmonitionNodeandGalleryNodeonly have handlers for thehtml,latexandtextbuilders. sphinx-markdown-builder (builder namemarkdown) skips nodes it has no handler for, so notebook code cells,nbinfo/nbwarningboxes and galleries were dropped from its output, each with aWARNING: unknown node type.This registers
markdownhandlers the same way thetextbuilder is handled (do_nothing), so the children (theliteral_blockof a code cell, the paragraphs of an info box, ...) get rendered by the Markdown translator.Reproduction (
nbsphinx_execute = 'never', a notebook with a markdown cell, two code cells with outputs, analert-infobox and annbgallery;sphinx-build -b markdown, Sphinx 9.1.1, sphinx-markdown-builder 0.6.11):Before:
and
nb.mdcontains only the markdown cells (0 code blocks).After: no warnings, and every code cell shows up as a fenced block:
Note: plain-text outputs now appear too, but sphinx-markdown-builder currently emits the content of every
rawnode regardless of its format, so the.. raw:: html/latex/textvariants of an output are all written out. That is liran-funaro/sphinx-markdown-builder#74, not something nbsphinx can fix by itself.The
htmlandtextbuilds of the same project are unchanged.