Skip to content

Conversation

@ryneeverett
Copy link
Contributor

Treats <td> as an inline element even though it's a block element. As far as I know, there's no way to have multi-line cells with the tables extension, and simply using an html <td> gets wrapped in an additional <td>, so I think there's a case for an exception. This deficiency has practical consequences.

Example:

import markdown


example = """\
First Header                                           | Second Header
------------------------------------------------------ | -------------
Content Cell{: class="foo bar" title="Some title!" }   | Content Cell
Content Cell                                           | Content Cell{: class="foo bar" title="Some title!" }
"""

output = markdown.markdown(example, extensions=['extra'])
print """-----------------------------------------------
EXAMPLE OUTPUT:
    %s
-------------------------------------------------""" % output

Output Before:

-----------------------------------------------
EXAMPLE OUTPUT:
    <table>
<thead>
<tr>
<th>First Header</th>
<th>Second Header</th>
</tr>
</thead>
<tbody>
<tr>
<td>Content Cell{: class="foo bar" title="Some title!" }</td>
<td>Content Cell</td>
</tr>
<tr>
<td>Content Cell</td>
<td>Content Cell{: class="foo bar" title="Some title!" }</td>
</tr>
</tbody>
</table>
-------------------------------------------------

Output After:

-----------------------------------------------
EXAMPLE OUTPUT:
    <table>
<thead>
<tr>
<th>First Header</th>
<th>Second Header</th>
</tr>
</thead>
<tbody>
<tr>
<td class="foo bar" title="Some title!">Content Cell/n</td>
<td>Content Cell</td>
</tr>
<tr>
<td>Content Cell</td>
<td class="foo bar" title="Some title!">Content Cell</td>
</tr>
</tbody>
</table>
-------------------------------------------------

@waylan
Copy link
Member

waylan commented Nov 14, 2013

I guess this seems reasonable. I'm generally not keen on adding improvements to tables (see my explanation in issue #74). But this is actually a tweek on the attr_list extension which would even be required if a different table extension was being used. Although, a test would be good. Add a test and I'll merge this.

Also, apparently I need to be following python markdown related questions on stack overflow. Nobody seems to use the official list any more - the only place I expect support questions to be asked (github is for bugs not support). If only I could follow and respond to stack overflow like an email list. Call me old school, but email list serves are still the best format IMO.

@ryneeverett
Copy link
Contributor Author

Actually, in response that stack question I demonstrated that table extensions which allow multi-line cells are compatible with the current attr_list extension.

The reason I did not add a test is that the existent tests only apply individual extensions, not the entire extra extension. It seemed silly to add a syntax test just for those two lines. It seems like there ought to be an extension-compatibility test which applies all of them, or am I missing it?

I'm annoyed that there doesn't seem to be any way to subscribe to multi-tag combinations on SO (like searching for "[python][markdown]", but your'e an expert of markdown generally so it's probably just as well if you patrol them all. I'm a 90's baby so I find mailing lists intimidating.

@me-and
Copy link
Contributor

me-and commented Nov 14, 2013

@waylan, I didn't realise there was a mailing list until now (I've just signed up). Stack Overflow lets folk ask questions without needing to find the correct forum for those questions, and the points system means the answers tend to be a bit more friendly than the brutal treatment I've seen people getting on a few support lists.

You can't sign up for emails from Stack Overflow AFAIK, but you can add RSS feeds for specific tags to an RSS reader. I'm sure there are services that'll convert RSS to email, too.

@waylan
Copy link
Member

waylan commented Jan 9, 2014

@ryneeverett I'm still waiting for a test for this. A test is never silly. If you want to add the test for only two extensions you can totally do that. As documented, in the test.cfg file, the extensions option accepts a comma delimited list of extension names. Just be sure to not include any whitespace in the list. So something like:

[tables_and_attr_list]
extensions=tables,attr_list

@ryneeverett ryneeverett reopened this Jan 11, 2014
waylan pushed a commit that referenced this pull request Jan 12, 2014
tables and attr_list compatibility
@waylan waylan merged commit 73fdeca into Python-Markdown:master Jan 12, 2014
@ryneeverett ryneeverett deleted the attr_list-tables branch May 16, 2014 02:26
@waylan waylan mentioned this pull request Jun 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extension Related to one or more of the included extensions. feature Feature request.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants