diff --git a/Markdown.pl b/Markdown.pl index 282414b..28d89bb 100755 --- a/Markdown.pl +++ b/Markdown.pl @@ -1944,8 +1944,12 @@ sub _DoTables { elsif (/:$/) {" align=\"right\""} else {""} } @seps; - my $tab ="\n\n" . - " " . _MakeTableRow("th", \@align, @heads) . "\n"; + my $nohdr = ""; + $nohdr = " $opt{style_prefix}table-nohdr" if join("", @heads) eq ""; + my $tab ="\n
\n"; + $tab .= + " " . _MakeTableRow("th", \@align, @heads) . "\n" + unless $nohdr; my $cnt = 0; my @classes = ("class=\"$opt{style_prefix}row-even\"", "class=\"$opt{style_prefix}row-odd\""); $tab .= " " . _MakeTableRow("td", \@align, _SplitTableRow($_)) . "\n" diff --git a/syntax.md b/syntax.md index ecc91c2..8c892ca 100644 --- a/syntax.md +++ b/syntax.md @@ -574,14 +574,16 @@ Output:
Bean$0.37Fiber
-The leading and trailing `|` on each line are optional unless there is only -a single column in which case at least one `|` is always required -- two if -the single column contains only whitespace. +The leading `|` on each line is optional unless the first column contains only +zero or more spaces and/or tabs. The trailing `|` on each line is optional +unless the last column contains only zero or more spaces and/or tabs. + +At least one `|` must be present in every row of the table. Leading and trailing whitespace are always trimmed from each column's value before using it. -To include a literal `|` (veritical bar) character in a column's value, precede +To include a literal `|` (vertical bar) character in a column's value, precede it with a `\` (backslash). To include a literal `\` use `\\` (double them). The number of columns in the separator row must match exactly the number of @@ -595,6 +597,10 @@ be `right`. And finally, with a colon on both ends the alignment will be `center`. The alignment will be applied to the column in both header and body rows. +If all columns in the header row are empty (i.e. contain only zero or more +spaces and/or tabs), the header row will be omitted from the output. Empty +rows in the body of the table are always preserved in the output. + Body rows that contain fewer columns than the header row have empty columns added. Body rows that contain more columns than the header row have the extra columns dropped.