redbug312 / markdown-it-multimd-table

Multimarkdown table syntax plugin for markdown-it markdown parser
MIT License
146 stars 37 forks source link

Add "caption-side" CSS depending on whether the caption is below or above table #58

Closed FelisDiligens closed 1 year ago

FelisDiligens commented 1 year ago

Description

Currently, whether a caption is placed above or below the table in Markdown isn't really taken into account. The resulting caption stays on top.

This pull request adds a style attribute to the <caption> tag, containing caption-side: bottom, if the caption is placed below the table.
(The default value of caption-side is top, which is why I chose to omit it. See MDN)

I also updated the test fixtures to include the style attribute.

Please let me know, if there's something wrong with the PR.

Examples

| Example table ||
|----------------|
|  Foo  |  Bar   |
[Caption below]

Results in

grafik

[Caption above]
| Example table ||
|----------------|
|  Foo  |  Bar   |

Results in

grafik

coveralls commented 1 year ago

Pull Request Test Coverage Report for Build 4476942550

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details


Totals Coverage Status
Change from base Build 4427271110: 0.0%
Covered Lines: 235
Relevant Lines: 235

💛 - Coveralls
redbug312 commented 1 year ago

Thank you and the PR looks good. I'll merge it later in v4.2.2.