Skip to content
Open
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 79 additions & 1 deletion spec.txt
Original file line number Diff line number Diff line change
Expand Up @@ -306,9 +306,15 @@ A line containing no characters, or a line containing only spaces

The following definitions of character classes will be used in this spec:

A [zero-width space](@) character is a non-printing and usually invisible
character (`U+200B`) (encodable in HTML as \​ or \​), which can be
used, for instance, for special spacing effects in text (and which in Markdown
can also be used to change the meaning of an adjacent character).

A [Unicode whitespace character](@) is
any code point in the Unicode `Zs` general category, or a tab (`U+0009`),
line feed (`U+000A`), form feed (`U+000C`), or carriage return (`U+000D`).
line feed (`U+000A`), form feed (`U+000C`), carriage return (`U+000D`),
or [zero-width space].

[Unicode whitespace](@) is a sequence of one or more
[Unicode whitespace characters].
Expand Down Expand Up @@ -611,6 +617,78 @@ foo
````````````````````````````````


## Zero-width space

For most use-cases requiring escapes it's worth considering using [backslash
escapes], but [zero-width space] can be useful sometimes as well (to change the
meaning of an adjacent character, etc.).

Given differences in utilization of whitespace, zero-width space can be used to
ensure emphasis, etc. in East Asian text:

```````````````````````````````` example
棕色*狐狸。*​跳过
.
<p>棕色<em>狐狸。</em>​跳过</p>
````````````````````````````````


Zero-width space may also need to be used to achieve some emphasis effects
while satisfying Markdown's [emphasis and strong emphasis] rules:

```````````````````````````````` example
Hello *Super-*&#8203;**man**
.
<p>Hello <em>Super-</em>​<strong>man</strong></p>

````````````````````````````````

```````````````````````````````` example
Hello ***Super***&#8203;**-man**
.
<p>Hello <em><strong>Super</strong></em>​<strong>-man</strong></p>

````````````````````````````````


Zero-width space can also be used to achieve some combined effects such as mixed
bold/italic mark-up:

```````````````````````````````` example
**bold*bold-italic***&#x200B;*italic*&#x200B;***bold-italic*bold**
.
<p><strong>bold<em>bold-italic</em></strong>​<em>italic</em>​<strong><em>bold-italic</em>bold</strong></p>

````````````````````````````````


Zero-width space can be used to escape an indicator of inline structure with
content:
```````````````````````````````` example
2&#x200B;*3&#x200B;*4 = 24
.
<p>2​*3​*4 = 24</p>
````````````````````````````````


However, unlike backslash escapes, zero-width space cannot be used to escape
each in a set of consecutive indicators of inline structure:
```````````````````````````````` example
2&#x200B;*&#x200B;*3&#x200B;*&#x200B;*4 = 2,417851639×10²⁴
.
<p>2​*​<em>3​</em>​*4 = 2,417851639×10²⁴</p>
````````````````````````````````


Instead, it would be necessary, for instance, to escape only the initial
indicator of inline structure in a set of consecutive such indicators:
```````````````````````````````` example
2&#x200B;**3&#x200B;**4 = 2,417851639×10²⁴
.
<p>2​**3​**4 = 2,417851639×10²⁴</p>
````````````````````````````````


## Entity and numeric character references

Valid HTML entity references and numeric character references
Expand Down