Python-Markdown / markdown

A Python implementation of John Gruber’s Markdown with Extension support.
https://python-markdown.github.io/
BSD 3-Clause "New" or "Revised" License
3.79k stars 862 forks source link

Add `set_css_classes` configuration option to the table extension #1384

Closed mikev-db closed 1 year ago

mikev-db commented 1 year ago

A new boolean option set_css_classes adds css classes to the table generation. These classes include row and columns counts and parity and will allow for more granular table styling.

waylan commented 1 year ago

Interesting suggestion. However, I'm curious why it has taken so many years for anyone to ask for this. Makes me wonder if it is necessary. Is there a way to accomplish what you want without these classes? If so they are redundant and unnecessary.

facelessuser commented 1 year ago

Using things like :nth-child() for styling is really all that is needed. I guess adding classes could make it "easier", but I'd argue not necessary.

mikev-db commented 1 year ago

@facelessuser I am using this in email templates, and gmail, outlook, etc do not support :nth-child(). I could not find any other way to accomplish this. Thanks!

waylan commented 1 year ago

If you search through past feature requests you will see that I am generally resistant to adding features to the tables extension. The extension provides the most basic table support. For anything more than that, a third party extension should be used (of which there are many). As this is not necessary in the common case, I am not inclined to add it.