Skip to content

Render centered and caption inline instead of dropping them#51

Open
calsmith1-nokia wants to merge 1 commit into
liran-funaro:mainfrom
calsmith1-nokia:transparent-centered-and-caption
Open

Render centered and caption inline instead of dropping them#51
calsmith1-nokia wants to merge 1 commit into
liran-funaro:mainfrom
calsmith1-nokia:transparent-centered-and-caption

Conversation

@calsmith1-nokia

@calsmith1-nokia calsmith1-nokia commented Apr 16, 2026

Copy link
Copy Markdown

See commit message for the rationale and approach.

Notes for reviewers

The current rendering is intentionally minimal — it just preserves the text. Caption text is concatenated to the image / appears as a paragraph above the code fence rather than being styled as a label. A future change could give caption a richer handler (e.g., bold, italic, or a separator); this PR scopes itself to ending the silent data loss.

Test plan

  • make lint clean (pylint 10.00/10).
  • make test — pytest 13/13 passing, 98% coverage.
  • make test-diffExampleRSTFile.md and index.md clean. (Identical pre-existing intersphinx-network diffs on other files are present on stock main.)

.. figure:: /static/markdown.png
:alt: Captioned figure example.

Figure caption text.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:caption: is invoked from here, not :alt:

The centered and caption docutils node types have no visit handler
in the translator and currently fall through to unknown_visit and
SkipNode. Their inner text is silently dropped: ".. centered::"
lines vanish, and figure captions and code-block ":caption:"
filenames are lost.

Mark both as transparent wrappers in PREDEFINED_ELEMENTS so their
inner text is emitted inline. The output is intentionally minimal
(no bold, italic, or layout styling) -- the goal of this change is
to end the silent data loss; richer rendering can come in a
follow-up.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@calsmith1-nokia
calsmith1-nokia force-pushed the transparent-centered-and-caption branch from 9b749b5 to af0bc39 Compare April 16, 2026 23:15
@calsmith1-nokia calsmith1-nokia changed the title Render centered and caption nodes transparently instead of dropping their text Render centered and caption inline instead of dropping them Apr 16, 2026
@calsmith1-nokia
calsmith1-nokia marked this pull request as ready for review April 16, 2026 23:18
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.

1 participant