fix: render nested code-cell source instead of dropping it - #729
Open
BetterAndBetterII wants to merge 1 commit into
Open
fix: render nested code-cell source instead of dropping it#729BetterAndBetterII wants to merge 1 commit into
BetterAndBetterII wants to merge 1 commit into
Conversation
Nested `{code-cell}` directives (e.g. inside tab-set/note) never become
notebook cells, but discarding them hid the source entirely. Keep the
warning and fall back to a literal_block so the code still appears.
Fixes executablebooks#723
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.
Summary
Nested
{code-cell}directives (for example inside{tab-set}/{tab-item}or other containers) are not converted into notebook cells by the Markdown reader.UnexpectedCellDirectivepreviously returned an empty node list, so the source disappeared from the built HTML while only a warning remained.Keep the existing warning, and fall back to rendering the cell source as a
literal_block(with the language from the directive argument when present). Nested cells are still not executed.Test plan
pytest tests/test_text_based.py— newtest_nested_code_cell_renders_sourceasserts nested source appears in HTML and the unexpected-cell warning still firestests/test_text_based.py,tests/test_codecell_file.py,tests/test_docutils.py) and full suite green locallyFixes #723