From 6459d419cdd09b6006258762e26a72aa17e6d48a Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Tue, 28 Oct 2014 21:52:31 -0700 Subject: Clarified emph/strong rules. Make it clear that in `**foo **bar baz**` the shorter of the two potential strong emphasis spans (`bar baz`) is preferred. --- spec.txt | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) (limited to 'spec.txt') diff --git a/spec.txt b/spec.txt index 2459321..a3ac6c0 100644 --- a/spec.txt +++ b/spec.txt @@ -4328,15 +4328,21 @@ the following principles resolve ambiguity: 12. An interpretation `...` is always preferred to `..`. -13. Earlier closings are preferred to later closings. Thus, - when two potential emphasis or strong emphasis spans overlap, - the first takes precedence: for example, `*foo _bar* baz_` - is parsed as `foo _bar baz_` rather than - `*foo bar* baz`. For the same reason, +13. When two potential emphasis or strong emphasis spans overlap, + so that the second begins before the first ends and ends after + the first ends, the first is preferred. Thus, for example, + `*foo _bar* baz_` is parsed as `foo _bar baz_` rather + than `*foo bar* baz`. For the same reason, `**foo*bar**` is parsed as `foobar*` rather than `foo*bar`. -14. Inline code spans, links, images, and HTML tags group more tightly +14. When there are two potential emphasis or strong emphasis spans + with the same closing delimiter, the shorter one (the one that + opens later) is preferred. Thus, for example, + `**foo **bar baz**` is parsed as `**foo bar baz` + rather than `foo **bar baz`. + +15. Inline code spans, links, images, and HTML tags group more tightly than emphasis. So, when there is a choice between an interpretation that contains one of these elements and one that does not, the former always wins. Thus, for example, `*[foo*](bar)` is @@ -4969,6 +4975,20 @@ The following cases illustrate rule 13: The following cases illustrate rule 14: +. +**foo **bar baz** +. +

**foo bar baz

+. + +. +*foo *bar baz* +. +

*foo bar baz

+. + +The following cases illustrate rule 15: + . *[foo*](bar) . -- cgit v1.2.3