Skip to content

Commit

Permalink
Allow implementers to emit i and b
Browse files Browse the repository at this point in the history
  • Loading branch information
snan committed Mar 27, 2023
1 parent 414c3e1 commit 6a254f5
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions spec.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6273,29 +6273,31 @@ The following rules define emphasis and strong emphasis:
`_`-delimited emphasis or `__`-delimited strong emphasis, unless it
is backslash-escaped.

Where rules 1--12 above are compatible with multiple parsings,
13. Implementers can emit `<i>` and `<b>` instead of `<em>` and `<strong>`.

Where rules 1--13 above are compatible with multiple parsings,
the following principles resolve ambiguity:

13. The number of nestings should be minimized. Thus, for example,
14. The number of nestings should be minimized. Thus, for example,
an interpretation `<strong>...</strong>` is always preferred to
`<em><em>...</em></em>`.

14. An interpretation `<em><strong>...</strong></em>` is always
15. An interpretation `<em><strong>...</strong></em>` is always
preferred to `<strong><em>...</em></strong>`.

15. When two potential emphasis or strong emphasis spans overlap,
16. 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 takes precedence. Thus, for example,
`*foo _bar* baz_` is parsed as `<em>foo _bar</em> baz_` rather
than `*foo <em>bar* baz</em>`.

16. When there are two potential emphasis or strong emphasis spans
17. When there are two potential emphasis or strong emphasis spans
with the same closing delimiter, the shorter one (the one that
opens later) takes precedence. Thus, for example,
`**foo **bar baz**` is parsed as `**foo <strong>bar baz</strong>`
rather than `<strong>foo **bar baz</strong>`.

17. Inline code spans, links, images, and HTML tags group more tightly
18. 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
Expand Down Expand Up @@ -7269,7 +7271,7 @@ _foo____
````````````````````````````````


Rule 13 implies that if you want emphasis nested directly inside
Rule 14 implies that if you want emphasis nested directly inside
emphasis, you must use different delimiters:

```````````````````````````````` example
Expand Down Expand Up @@ -7318,7 +7320,7 @@ ____foo____



Rule 13 can be applied to arbitrarily long sequences of
Rule 14 can be applied to arbitrarily long sequences of
delimiters:

```````````````````````````````` example
Expand All @@ -7328,7 +7330,7 @@ delimiters:
````````````````````````````````


Rule 14:
Rule 15:

```````````````````````````````` example
***foo***
Expand All @@ -7344,7 +7346,7 @@ _____foo_____
````````````````````````````````


Rule 15:
Rule 16:

```````````````````````````````` example
*foo _bar* baz_
Expand All @@ -7360,7 +7362,7 @@ Rule 15:
````````````````````````````````


Rule 16:
Rule 17:

```````````````````````````````` example
**foo **bar baz**
Expand All @@ -7376,7 +7378,7 @@ Rule 16:
````````````````````````````````


Rule 17:
Rule 18:

```````````````````````````````` example
*[bar*](/url)
Expand Down

0 comments on commit 6a254f5

Please sign in to comment.