Column alignments in tables
I'm having a problem with how Marked is creating tables. In
particularly, how it (i) imposes a column alignment of
<col style="text-align:left;"/>
by default and
(ii) how it applies an alignment to each cell element. Consider the
attached table ("table.mdown")
Marked assigns a <col
style="text-align:left;"/>
to the first column when, in
fact, there is no explicitly specified alignment. Moreover, an
alignment is applied to each <th>
and
<td>
. In addition to making for bloated HTML
code, this also limits the styling of the table by CSS. For
example, within a certain column I would like to center the
<th>
cells but have the <td>
cells aligned differently. This can be done with CSS (tr >
td:nth-child(1)
, for example) but the way Marked generates
the HTML makes this impossible.
I would rather Marked not explicitly assign a column alignment
and an alignment on each <td>
. I much prefer
Byword's interpretation, which is also attached.
- table.mdown 251 Bytes
- marked_output.htm 1.76 KB
- byword_output.htm 657 Bytes
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
Support Staff 1 Posted by Brett on 08 Feb, 2012 03:10 PM
This is an issue with the version of MultiMarkdown included in Marked. It's not a Marked issue, and Marked makes no special changes to this output. If the output is an issue, please file a ticket with Fletcher at https://github.com/fletcher/peg-multimarkdown/issues . If he can make changes to satisfy your needs, I'll gladly update the version included in Marked to match.
Thanks,
Brett
2 Posted by keith.knipling on 09 Feb, 2012 01:33 AM
FYI:
https://github.com/fletcher/peg-multimarkdown/issues/105#issuecomme...
What I love about Marked is the ability apply custom CSS stylesheets to my documents. Unfortunately, applying CSS to tables is fairly impossible with the current implementation of Multimarkdown. I appreciate how Byword deals with this problem (see attachments above).
Thanks,
Keith
Support Staff 3 Posted by Brett on 09 Feb, 2012 01:57 AM
Understood. I'll see if I can persuade Fletcher to offer an option to output clean markup without disabling all MultiMarkdown features. Thanks for following up.