#1349 how to create tables in pagure markdown?
Closed: Fixed 7 years ago Opened 7 years ago by pnemade.

I need to add table in README.md file but I just can't find a working way to do that. When I searched on google, I found 2 different ways
1) html style syntax tr,td but its not working
2) dashes and pipes way but its also not working.

Please tell me how to create a table.


test test2
row 2 row2, cell 2

So it seems to be working but would require a little CSS to look nicer :)

@ryanlerch do you want to look at styling the tables in the CSS so they look better in the comments, or shall I?

Is there a way to get the comment output just to add the "table" class to table tags in the comments, the Css should do the rest!

test test2
row 2 row2, cell 2

@ryanlerch I found a way to allow/do this

@pnemade would this work for you? (ie: just adding a class="table" in the html table?

huh I wrote here after 12 hours of inactivity and lost the comment

okay writing again the comment,

I am fine with any syntax as long as I can write tables in project readme pages and people can read it. e.g. I have this page https://pagure.io/g11n where table is not readable.

I'm sure everyone involved knows already, but python-markdown does have a table extension which supports the usual dashes and pipes syntax. But I guess either it's not enabled by pagure, or it's not present in the probably old version of python-markdown present in RHEL.

Is there any reason not to enable basically every even moderately useful packaged extension?

And, also, if this is just for the README file, why not use rst instead? Doesn't help for comments, of course.

First Header Second Header
Content Cell Content Cell
Content Cell Content Cell
First Header Second Header
Content Cell Content Cell
Content Cell Content Cell

This does not seem to be supported in Fedora as well, do you have a
link/reference to where I could find this markdown extension?

Thanks! :)

Just wondering if we should just make the markdown generator add the table class to the output (if possible) rather than requiring people to put it in their markdown. Requiring people to add a class to the markdown is fiddly, and pollutes the markdown with pagure-specificness.

Most, if not all tables in markdown or any of the other supported markups people are using to display data, rather than for layout, so this should be fine.

The solution of class="table" is if the user enters the table in html directly, our current markdown doesn't support table, which is something I'd like to fix if there is an extension to do it for us, in which case I agree that it'd be up to the extension/markdown processor to add the correct css tags.

Hmm, as far as I can tell at least in Fedora, python-markdown comes pre-packaged with the necessary extension. Of course you have to enable it (by adding 'markdown.extensions.tables' or 'markdown.extension.extra' to your extension list). As far as I can tell there's just one place in the pagure code which needs changes, but I don't have a running pagure instance I can hack on at the moment.

The extension docs should be in /usr/share/doc/python*-markdown/extensions/tables.txt. As far as I can tell, the rhel7 version of python-markdown has this extension available as well.

There are a number of supplied extensions which would probably be pretty useful. In fact, pretty much all of the stock ones included with python-markdown, really. At a quick reading, I'd suggest:abbreviations, admonition, attribute lists, the codehilite extension that links into pygments, definition lists, fenced code, footnotes, sane lists, smart strong, table of contents. Some of those are also included in the "extra" extension.

I kind of feel like I must really be missing something, as I'm sure you know way more about python-markdown than I do.

@pingou changed the status to Closed

7 years ago

I opened #1455 to continue with the general issue of markdown extensions.

Login to comment on this ticket.

Metadata