Skip to content

Blank lines are missing around figure and table captions #113

@chrispy-snps

Description

@chrispy-snps

For <table> elements, a newline is missing between the <caption> element and the first | (pipe) character in the table structure:

from markdownify import markdownify as md
md('TEXT<table><caption>Caption</caption><tr><td>CELL</td></tr></tbody></table>')  # > 'TEXT\n\nCaption| CELL |\n\n'
#                                                                                               ^^^^^^^^

For <figure> elements, blank lines are missing around <figcaption> elements at the top or bottom of the figure:

from markdownify import markdownify as md
md('TEXT<figure><figcaption>Caption</figcaption><span>SPAN</span></figure>')  # > 'TEXTCaptionSPAN'
#                                                                                     ^^^^^^^^^
md('<figure><span>SPAN</span><figcaption>Caption</figcaption></figure>TEXT')  # > 'SPANCaptionTEXT'
#                                                                                     ^^^^^^^^^

These tests use inline text content and no newlines to test the worst-case output scenario (no extra newlines in input propagating to output).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions