Skip to content

Add a blank line between table captions and table content #166

Closed

Description

@chrispy-snps

Currently, table <caption> elements are placed directly adjacent to the table content:

import markdownify

html = """\
<table>
 <caption>Table caption</caption>
 <thead><tr><th>Header 1</th><th>Header 2</th></tr></thead>
 <tbody><tr><td>Body 1</td><td>Body 2</td></tr></tbody>
</table>
d
"""

print(markdownify.markdownify(html))
# Table caption
# | Header 1 | Header 2 |
# | --- | --- |
# | Body 1 | Body 2 |

However, Pandoc requires a blank line before the table content to avoid ambiguity:

$ pandoc --wrap=none test.md --to html
<p>Table caption | Header 1 | Header 2 | | — | — | | Body 1 | Body 2 |</p>

To resolve this, <caption> elements could include an additional newline after them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions