Skip to content

Commit

Permalink
Match interior delimiter runs if lengths of both are multiples of 3.
Browse files Browse the repository at this point in the history
This gives better results on `a***b***c` without giving bad results
on the cases that motivated the original multiple of 3 rule.

Closes #528.
  • Loading branch information
jgm committed Mar 23, 2019
1 parent 9c6c62f commit 83ed53e
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions spec.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6109,7 +6109,8 @@ The following rules define emphasis and strong emphasis:
[delimiter runs]. If one of the delimiters can both
open and close emphasis, then the sum of the lengths of the
delimiter runs containing the opening and closing delimiters
must not be a multiple of 3.
must not be a multiple of 3 unless both lengths are
multiples of 3.

10. Strong emphasis begins with a delimiter that
[can open strong emphasis] and ends with a delimiter that
Expand All @@ -6119,7 +6120,8 @@ The following rules define emphasis and strong emphasis:
[delimiter runs]. If one of the delimiters can both open
and close strong emphasis, then the sum of the lengths of
the delimiter runs containing the opening and closing
delimiters must not be a multiple of 3.
delimiters must not be a multiple of 3 unless both lengths
are multiples of 3.

11. A literal `*` character cannot occur at the beginning or end of
`*`-delimited emphasis or `**`-delimited strong emphasis, unless it
Expand Down Expand Up @@ -6738,7 +6740,8 @@ is precluded by the condition that a delimiter that
can both open and close (like the `*` after `foo`)
cannot form emphasis if the sum of the lengths of
the delimiter runs containing the opening and
closing delimiters is a multiple of 3.
closing delimiters is a multiple of 3 unless
both lengths are multiples of 3.


For the same reason, we don't get two consecutive
Expand Down Expand Up @@ -6778,6 +6781,23 @@ omitted:
````````````````````````````````


When the lengths of the interior closing and opening
delimiter runs are *both* multiples of 3, though,
they can match to create emphasis:

```````````````````````````````` example
foo***bar***baz
.
<p>foo<em><strong>bar</strong></em>baz</p>
````````````````````````````````

```````````````````````````````` example
foo******bar*********baz
.
<p>foo<strong><strong><strong>bar</strong></strong></strong>***baz</p>
````````````````````````````````


Indefinite levels of nesting are possible:

```````````````````````````````` example
Expand Down

0 comments on commit 83ed53e

Please sign in to comment.