From ee779cb7f8ea3c6274aef89f9916931b907e211e Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Mon, 27 Jun 2016 15:23:26 -0700 Subject: Revert "Revert "ATX headers: clarify where tabs can go."" This reverts commit 85bd3b9b149bef97755f16538e9c01cc386f6e5b. --- spec.txt | 64 +++++++++++++++++++++++++++++++++++++++++----------------------- 1 file changed, 41 insertions(+), 23 deletions(-) (limited to 'spec.txt') diff --git a/spec.txt b/spec.txt index 32c99c2..738ee96 100644 --- a/spec.txt +++ b/spec.txt @@ -730,17 +730,18 @@ If you want a thematic break in a list item, use a different bullet: ## ATX headings -An [ATX heading](@) -consists of a string of characters, parsed as inline content, between an -opening sequence of 1--6 unescaped `#` characters and an optional -closing sequence of any number of unescaped `#` characters. -The opening sequence of `#` characters must be followed by a -[space] or by the end of line. The optional closing sequence of `#`s must be -preceded by a [space] and may be followed by spaces only. The opening -`#` character may be indented 0-3 spaces. The raw contents of the -heading are stripped of leading and trailing spaces before being parsed -as inline content. The heading level is equal to the number of `#` -characters in the opening sequence. +An [ATX heading](@) consists of a string of characters, parsed +as inline content, between an opening sequence of 1--6 unescaped +`#` characters and an optional closing sequence of any number of +unescaped `#` characters. The opening sequence of `#` +characters must be followed by a [space], a tab, or by the end of +the line. The optional closing sequence of `#`s must be preceded +by a [space] or tab and may be followed by spaces or tabs only. +The opening `#` character may be indented 0-3 spaces. The raw +contents of the heading are stripped of leading and trailing +spaces and tabs before being parsed as inline content. The +heading level is equal to the number of `#` characters in the +opening sequence. Simple headings: @@ -770,7 +771,7 @@ More than six `#` characters is not a heading: ```````````````````````````````` -At least one space is required between the `#` characters and the +At least one space or tab is required between the `#` characters and the heading's contents, unless the heading is empty. Note that many implementations currently do not require the space. However, the space was required by the @@ -788,12 +789,21 @@ headings: ```````````````````````````````` -A tab will not work: +A tab can be used instead of a space: ```````````````````````````````` example #→foo . -

#→foo

+

foo

+```````````````````````````````` + + +Any number of spaces and tabs can be used after the `#`s: + +```````````````````````````````` example +# →→ foo +. +

foo

```````````````````````````````` @@ -815,16 +825,16 @@ Contents are parsed as inlines: ```````````````````````````````` -Leading and trailing blanks are ignored in parsing inline content: +Leading and trailing spaces and tabs are ignored in parsing inline content: ```````````````````````````````` example -# foo +# →→ foo →→ .

foo

```````````````````````````````` -One to three spaces indentation are allowed: +One to three spaces indentation are allowed before the first `#`: ```````````````````````````````` example ### foo @@ -878,18 +888,18 @@ It need not be the same length as the opening sequence: ```````````````````````````````` -Spaces are allowed after the closing sequence: +Spaces and tabs are allowed after the closing sequence: ```````````````````````````````` example -### foo ### +### foo ###→ .

foo

```````````````````````````````` -A sequence of `#` characters with anything but [spaces] following it -is not a closing sequence, but counts as part of the contents of the -heading: +A sequence of `#` characters with anything but spaces or tabs +following it is not a closing sequence, but counts as part of +the contents of the heading: ```````````````````````````````` example ### foo ### b @@ -898,7 +908,7 @@ heading: ```````````````````````````````` -The closing sequence must be preceded by a space: +The closing sequence must be preceded by at least one space or tab: ```````````````````````````````` example # foo# @@ -906,6 +916,12 @@ The closing sequence must be preceded by a space:

foo#

```````````````````````````````` +```````````````````````````````` example +# foo→# +. +

foo

+```````````````````````````````` + Backslash-escaped `#` characters do not count as part of the closing sequence: @@ -952,10 +968,12 @@ ATX headings can be empty: ## # ### ### +####→#### .

+

```````````````````````````````` -- cgit v1.2.3