Closed knipling closed 12 years ago
Perhaps things have improved with HTML 5, but applying an alignment to the <col>
element does not (did not?) actually change the alignment of the cells in that column on the browsers I last tested anyway. That's why it's done this way for HTML. Additionally, the alignment specifications from HTML were used by the XSLT when creating LaTeX for MMD 2, and for some users of MMD 3, which was also made easier by more explicit stating of the alignments. Trust me --- the code would have been much easier if I only had to set the alignment on the <col>
element instead of each cell.
My goal for MMD is to make things work right for 90% of people 90% of the time. It can't manage every edge case that people could conceivably throw at it without requiring a syntax as bad as the things it is trying to simplify (e.g. HTML, LaTeX, RTF, etc).
If you really need fine grain control over tables, then you may need to specify your table as raw HTML, or you can create a custom XSLT or post-processing script to make tables behave the way you want them to. You are also welcome to change this in your own copy of MMD (it is open source for this reason). If you make some changes to the code that you really feel are superior, and want to send me some test documents to convince me to merge your code into the main branch, I would be happy to look at it.
At some point in the future, I may go back and revisit how table alignment works with HTML 5 and more modern browsers and see if it has improved. But this is a really low priority for me compared to the ever growing list of ideas I have for things I would like to work on with MMD and other projects, so I don't want to give you any false impression that I'm likely to get around to it any time soon, or even this year.
Asked another way, why bother specifying the column alignment (no-alignment versus left-alignment), if the following:
| Col 1 | Col 2 |
| ----- | :---- |
| This | This |
| is | is |
| not | left |
| aligned | aligned |
produces two columns with <col style="text-align:left;"/>
. Shouldn't only the second column have his alignment specified?
This is an artifact left over from using XSLT to convert HTML to LaTeX, etc, and being sure to get the proper alignment with minimal complexity.
But since the default for HTML is left aligned (for L to R languages, anyway), there's no practical difference. And while perhaps not strictly necessary anymore, would probably break some compatibility with XSLT files and I probably won't make a change just for this alone. Would be more inclined to revamp the whole approach at once.
I'm having a problem with how Multimarkdown creates tables. In particular, 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.For example, a
<col style="text-align:left;"/>
is applied to a 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 Multimarkdown generates the HTML makes this impossible.I would rather Multimarkdown not explicitly assign a column alignment and an alignment on each
<td>
.For examples, see this discussion about Brett Terpstra's Marked.app: http://support.markedapp.com/discussions/problems/173-column-alignments-in-tables