redbug312 / markdown-it-multimd-table

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

caption position is always bottom in bootstrap themed sites #71

Open markg85 opened 3 weeks ago

markg85 commented 3 weeks ago

Hi,

I'm building a markdown-it renderer with your plugin. It all renders in a GUI that uses the bootstrap theme.

Bootstrap defaults captions to caption-side: bottom;

Given your current code that means the caption will always render at the bottom because of this line:

        /* Add caption-side inline-CSS to <caption> tag, if caption is below the markdown table. */        if (capSide !== "top") {
          attrs.push([ "style", "caption-side: " + capSide ]);
        }

You only add the style when it's at the bottom.

My suggested fix? Always add the style that means you override whatever the user has done in their CSS. Which in this case is fine as you kinda explicitly set the caption position in the markdown itself based on where you put the caption.