Skip to content

Conversation

bittorala
Copy link
Contributor

Fix #51 : Python Markdown Extensions captions, which are availble in Material for MkDocs, get destroyed when using --wrap.

The caption

/// table-caption | 1.5.2
A table with letters.
///

was formatted as

/// table-caption | 1.5.2 A table with letters. ///

thus breaking the rendered caption in Material for MkDocs.

Now, we detect these captions as a token and avoid losing their delitimers.

Bittor Alaña added 4 commits May 28, 2025 14:51
Fix [issue KyleKing#51](KyleKing#51):
Python Markdown Extensions captions, which are availble in Material for
MkDocs, get destroyed when using `--wrap`.

The caption

```markdown
/// table-caption | 1.5.2
A table with letters.
///
```

was formatted as

```markdown
/// table-caption | 1.5.2 A table with letters. ///
```

thus breaking the rendered caption in Material for MkDocs.

Now, we detect these captions as a token and avoid losing their
delitimers.
Copy link
Owner

@KyleKing KyleKing left a comment

Choose a reason for hiding this comment

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

Thank you so much! I have a few minor comments and would like to see a test for the rendered HTML, but otherwise this looks great and is nearly ready to merge!

Bittor Alaña added 2 commits May 30, 2025 09:20
Implement comments in PR review by author:
- Named capture groups in REs.
- Only use `paragraph` in `alt` for captions.
- Wrap caption's content in a <p>.
- Strip content to get rid of captured newline in caption content.
@bittorala
Copy link
Contributor Author

Thank you very much for the quick and insightful review! I have implemented the suggestions and I see a noticeable improvement. I have left the correct HTML conversation open, in case we want to consider properly capturing things in a <figure>. It does seem slightly overkill for my use case, but my knowledge of this is quite limited, so it's up to you.

Copy link
Owner

@KyleKing KyleKing left a comment

Choose a reason for hiding this comment

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

Thanks! Looks good to me and I'll make a release this evening

@KyleKing KyleKing changed the title Add caption support fix(#51): add caption support May 30, 2025
@KyleKing KyleKing changed the title fix(#51): add caption support feat(#51): add caption support May 30, 2025
@KyleKing KyleKing merged commit fede1b2 into KyleKing:main May 31, 2025
7 checks passed
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.

Line wrap conflicts with mkdocs-material captions
2 participants