More continuing text for tables
waysoftheearth at yahoo.com.au
Tue Jun 23 00:01:27 EDT 2009
While translating documents in markdown, I've noticed that it is often
necessary to continue table cell text on the following line, especially when
limited to a narrow column, and especially in table headers. Unfortunately,
this is impossible with the existing table syntax, which interprets each new
line as a new table row.
I see that David Wheeler proposed a syntax for a text continuation in tables
based on database outputs (see
also recent discussion on this list).
Text continuation seems to me to be a desirable addition to markdown, and
DW's proposal looks very encouraging. The outstanding arguments I could
find against his proposed ':' cell separator are:
1. Not usable as described with proportional fonts,
2. Cannot distinguish between ':' as a separator and ':' as cell content.
I'd like to offer the following thoughts with a view to hopefully resolving
Use With Proportional Fonts
The ':' syntax could work exactly as per the existing '|' cell separator,
such that the ':' cell separator be *required* on the right of each column
rather than optional. The last column would continue to be optional, as per
the existing '|' cell syntax.
Thus, text may be continued over any number of lines in a table body, like
| Col A | Col B | Col C
1 | A1 | B1 | C1
: a2 contains : b2 : c2
: some long & : b2 : c2
: interesting : b2 : c2
2 | commentary | B2 | C2
3 | A3 | B3 | C3
Text may also be continued over any number of lines in a table header, like
: This is : :
: Continued : :
: for Ages : :
| and Ages! | Col B | Col C
1 | A1 | B1 | C1
2 | A2 | B2 | C2
This works exactly the way pipe '|' currently work with both proportional
and non-proportional fonts.
The question raised by the second example is how should markdown parsers
distinguish between a table which begins with text continuation markers, and
a list definition?
I believe this can be resolved by looking ahead to the following lines of
the document. Whether a table's compulsory '---' header/body separator line
is encountered before a blank line should be enough to establish context.
Distinguishing Cell Separator from Cell Content
The existing pipe separator syntax must also have this same issue, the
difference (presumably) being that;
* The colon is used more commonly in content than the pipe, and,
* ':' is markdown syntax denoting a definition list.
1. The simplest, but most restrictive, option is to simply not support
colons within cell content. All colons, in the context of tables, are
therefore cell delimiters.
2. A less restrictive option is to require all colons within table cell
content to be formally escaped, thus '\:'. While this works technically, it
has the disadvantage of polluting the source text.
3. An alternative option is to define the colon cell separator more exactly,
such that in the context of a table;
* Any colon encountered with leading or trailing text (e.g., 'text:' or
':text') is not a cell separator.
* Any colon encountered exactly one or two characters after a colon
(E.g., '::' or ': :') is not a cell separator. Thus, colons denoting cell
separators must always be at least two characters apart. This implies that
no column (excepting the first and last) can be a single character wide.
I believe that option 3 has the most appeal since it does not pollute the
source text at all, and only forces the author to create "neat" tables in
order to work.
In any case, it seems likely that the use of colons within table content
would be rare compared to the use of text continuing across lines.
Therefore, the inconvenience caused by any of the suggested options may be
acceptable to an author who really just wants text continuing across lines!
Just a few thoughts...
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Markdown-Discuss