Skip to content

fix: render nested code-cell source instead of dropping it - #729

Open
BetterAndBetterII wants to merge 1 commit into
executablebooks:mainfrom
BetterAndBetterII:fix/nested-code-cell-tabs
Open

fix: render nested code-cell source instead of dropping it#729
BetterAndBetterII wants to merge 1 commit into
executablebooks:mainfrom
BetterAndBetterII:fix/nested-code-cell-tabs

Conversation

@BetterAndBetterII

Copy link
Copy Markdown

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. UnexpectedCellDirective previously 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 — new test_nested_code_cell_renders_source asserts nested source appears in HTML and the unexpected-cell warning still fires
  • Related suite (tests/test_text_based.py, tests/test_codecell_file.py, tests/test_docutils.py) and full suite green locally

Fixes #723

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Code cells missing when used in tab-groups

1 participant