Fix wrapped {table} captions becoming body paragraphs - #1195
Open
BetterAndBetterII wants to merge 2 commits into
Open
Fix wrapped {table} captions becoming body paragraphs#1195BetterAndBetterII wants to merge 2 commits into
BetterAndBetterII wants to merge 2 commits into
Conversation
MyST only takes the directive argument from the opening fence line, so a hard-wrapped table caption leaked into the body and RSTTable failed with "exactly one table expected". Fold leading non-table body lines into the caption when a table follows. Fixes executablebooks#1104
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
MyST takes directive arguments from the opening fence line only. A hard-wrapped
{table}caption (common at ~70 columns) therefore becomes a leading paragraph in the body, andRSTTablefails with "exactly one table expected" even though the Markdown is otherwise valid.Fold leading non-table body lines into the table caption argument when a Markdown/rST table follows. Single-line captions and unrelated invalid body content are unchanged.
Test plan
tests/test_renderers/test_parse_directives.py)sphinx_directives.mdpytest tests/test_renderers/test_parse_directives.py tests/test_renderers/test_fixtures_sphinx.pyFixes #1104