summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/afl_dictionary/asterisk1
-rw-r--r--test/afl_dictionary/attr_generic1
-rw-r--r--test/afl_dictionary/attr_href1
-rw-r--r--test/afl_dictionary/attr_xml_lang1
-rw-r--r--test/afl_dictionary/attr_xmlns1
-rw-r--r--test/afl_dictionary/backslash1
-rw-r--r--test/afl_dictionary/backtick1
-rw-r--r--test/afl_dictionary/colon1
-rw-r--r--test/afl_dictionary/dashes1
-rw-r--r--test/afl_dictionary/double_quote1
-rw-r--r--test/afl_dictionary/entity_builtin1
-rw-r--r--test/afl_dictionary/entity_decimal1
-rw-r--r--test/afl_dictionary/entity_external1
-rw-r--r--test/afl_dictionary/entity_hex1
-rw-r--r--test/afl_dictionary/equals1
-rw-r--r--test/afl_dictionary/exclamation1
-rw-r--r--test/afl_dictionary/greater_than1
-rw-r--r--test/afl_dictionary/hash1
-rw-r--r--test/afl_dictionary/hyphen0
-rw-r--r--test/afl_dictionary/indent1
-rw-r--r--test/afl_dictionary/left_bracket1
-rw-r--r--test/afl_dictionary/left_paren1
-rw-r--r--test/afl_dictionary/less_than1
-rw-r--r--test/afl_dictionary/plus1
-rw-r--r--test/afl_dictionary/right_bracket1
-rw-r--r--test/afl_dictionary/right_paren1
-rw-r--r--test/afl_dictionary/single_quote1
-rw-r--r--test/afl_dictionary/string_any1
-rw-r--r--test/afl_dictionary/string_brackets1
-rw-r--r--test/afl_dictionary/string_cdata1
-rw-r--r--test/afl_dictionary/string_dashes1
-rw-r--r--test/afl_dictionary/string_empty_dblquotes1
-rw-r--r--test/afl_dictionary/string_empty_quotes1
-rw-r--r--test/afl_dictionary/string_idrefs1
-rw-r--r--test/afl_dictionary/string_parentheses1
-rw-r--r--test/afl_dictionary/string_pcdata1
-rw-r--r--test/afl_dictionary/tag_cdata1
-rw-r--r--test/afl_dictionary/tag_close1
-rw-r--r--test/afl_dictionary/tag_doctype1
-rw-r--r--test/afl_dictionary/tag_element1
-rw-r--r--test/afl_dictionary/tag_entity1
-rw-r--r--test/afl_dictionary/tag_notation1
-rw-r--r--test/afl_dictionary/tag_open1
-rw-r--r--test/afl_dictionary/tag_open_close1
-rw-r--r--test/afl_dictionary/tag_open_exclamation1
-rw-r--r--test/afl_dictionary/tag_open_q1
-rw-r--r--test/afl_dictionary/tag_sq2_close1
-rw-r--r--test/afl_dictionary/tag_xml_q1
-rw-r--r--test/afl_dictionary/underscore1
-rw-r--r--test/cmark.py10
-rw-r--r--test/spec.txt153
51 files changed, 155 insertions, 56 deletions
diff --git a/test/afl_dictionary/asterisk b/test/afl_dictionary/asterisk
new file mode 100644
index 0000000..f59ec20
--- /dev/null
+++ b/test/afl_dictionary/asterisk
@@ -0,0 +1 @@
+* \ No newline at end of file
diff --git a/test/afl_dictionary/attr_generic b/test/afl_dictionary/attr_generic
new file mode 100644
index 0000000..d84e4b2
--- /dev/null
+++ b/test/afl_dictionary/attr_generic
@@ -0,0 +1 @@
+ a="1" \ No newline at end of file
diff --git a/test/afl_dictionary/attr_href b/test/afl_dictionary/attr_href
new file mode 100644
index 0000000..cbb9775
--- /dev/null
+++ b/test/afl_dictionary/attr_href
@@ -0,0 +1 @@
+ href="1" \ No newline at end of file
diff --git a/test/afl_dictionary/attr_xml_lang b/test/afl_dictionary/attr_xml_lang
new file mode 100644
index 0000000..6dab3e9
--- /dev/null
+++ b/test/afl_dictionary/attr_xml_lang
@@ -0,0 +1 @@
+ xml:lang="1" \ No newline at end of file
diff --git a/test/afl_dictionary/attr_xmlns b/test/afl_dictionary/attr_xmlns
new file mode 100644
index 0000000..168863a
--- /dev/null
+++ b/test/afl_dictionary/attr_xmlns
@@ -0,0 +1 @@
+ xmlns="1" \ No newline at end of file
diff --git a/test/afl_dictionary/backslash b/test/afl_dictionary/backslash
new file mode 100644
index 0000000..b7d5379
--- /dev/null
+++ b/test/afl_dictionary/backslash
@@ -0,0 +1 @@
+\ \ No newline at end of file
diff --git a/test/afl_dictionary/backtick b/test/afl_dictionary/backtick
new file mode 100644
index 0000000..64845fb
--- /dev/null
+++ b/test/afl_dictionary/backtick
@@ -0,0 +1 @@
+` \ No newline at end of file
diff --git a/test/afl_dictionary/colon b/test/afl_dictionary/colon
new file mode 100644
index 0000000..22ded55
--- /dev/null
+++ b/test/afl_dictionary/colon
@@ -0,0 +1 @@
+: \ No newline at end of file
diff --git a/test/afl_dictionary/dashes b/test/afl_dictionary/dashes
new file mode 100644
index 0000000..73b314f
--- /dev/null
+++ b/test/afl_dictionary/dashes
@@ -0,0 +1 @@
+--- \ No newline at end of file
diff --git a/test/afl_dictionary/double_quote b/test/afl_dictionary/double_quote
new file mode 100644
index 0000000..9d68933
--- /dev/null
+++ b/test/afl_dictionary/double_quote
@@ -0,0 +1 @@
+" \ No newline at end of file
diff --git a/test/afl_dictionary/entity_builtin b/test/afl_dictionary/entity_builtin
new file mode 100644
index 0000000..1489a83
--- /dev/null
+++ b/test/afl_dictionary/entity_builtin
@@ -0,0 +1 @@
+< \ No newline at end of file
diff --git a/test/afl_dictionary/entity_decimal b/test/afl_dictionary/entity_decimal
new file mode 100644
index 0000000..7b997f6
--- /dev/null
+++ b/test/afl_dictionary/entity_decimal
@@ -0,0 +1 @@
+ \ No newline at end of file
diff --git a/test/afl_dictionary/entity_external b/test/afl_dictionary/entity_external
new file mode 100644
index 0000000..f626a66
--- /dev/null
+++ b/test/afl_dictionary/entity_external
@@ -0,0 +1 @@
+&a; \ No newline at end of file
diff --git a/test/afl_dictionary/entity_hex b/test/afl_dictionary/entity_hex
new file mode 100644
index 0000000..8766028
--- /dev/null
+++ b/test/afl_dictionary/entity_hex
@@ -0,0 +1 @@
+ \ No newline at end of file
diff --git a/test/afl_dictionary/equals b/test/afl_dictionary/equals
new file mode 100644
index 0000000..7193984
--- /dev/null
+++ b/test/afl_dictionary/equals
@@ -0,0 +1 @@
+=== \ No newline at end of file
diff --git a/test/afl_dictionary/exclamation b/test/afl_dictionary/exclamation
new file mode 100644
index 0000000..74e0f12
--- /dev/null
+++ b/test/afl_dictionary/exclamation
@@ -0,0 +1 @@
+! \ No newline at end of file
diff --git a/test/afl_dictionary/greater_than b/test/afl_dictionary/greater_than
new file mode 100644
index 0000000..0817502
--- /dev/null
+++ b/test/afl_dictionary/greater_than
@@ -0,0 +1 @@
+> \ No newline at end of file
diff --git a/test/afl_dictionary/hash b/test/afl_dictionary/hash
new file mode 100644
index 0000000..4287ca8
--- /dev/null
+++ b/test/afl_dictionary/hash
@@ -0,0 +1 @@
+# \ No newline at end of file
diff --git a/test/afl_dictionary/hyphen b/test/afl_dictionary/hyphen
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/afl_dictionary/hyphen
diff --git a/test/afl_dictionary/indent b/test/afl_dictionary/indent
new file mode 100644
index 0000000..136d063
--- /dev/null
+++ b/test/afl_dictionary/indent
@@ -0,0 +1 @@
+ \ No newline at end of file
diff --git a/test/afl_dictionary/left_bracket b/test/afl_dictionary/left_bracket
new file mode 100644
index 0000000..8e2f0be
--- /dev/null
+++ b/test/afl_dictionary/left_bracket
@@ -0,0 +1 @@
+[ \ No newline at end of file
diff --git a/test/afl_dictionary/left_paren b/test/afl_dictionary/left_paren
new file mode 100644
index 0000000..f46d387
--- /dev/null
+++ b/test/afl_dictionary/left_paren
@@ -0,0 +1 @@
+( \ No newline at end of file
diff --git a/test/afl_dictionary/less_than b/test/afl_dictionary/less_than
new file mode 100644
index 0000000..c5fa784
--- /dev/null
+++ b/test/afl_dictionary/less_than
@@ -0,0 +1 @@
+< \ No newline at end of file
diff --git a/test/afl_dictionary/plus b/test/afl_dictionary/plus
new file mode 100644
index 0000000..9b26e9b
--- /dev/null
+++ b/test/afl_dictionary/plus
@@ -0,0 +1 @@
++ \ No newline at end of file
diff --git a/test/afl_dictionary/right_bracket b/test/afl_dictionary/right_bracket
new file mode 100644
index 0000000..54caf60
--- /dev/null
+++ b/test/afl_dictionary/right_bracket
@@ -0,0 +1 @@
+] \ No newline at end of file
diff --git a/test/afl_dictionary/right_paren b/test/afl_dictionary/right_paren
new file mode 100644
index 0000000..e8a0f87
--- /dev/null
+++ b/test/afl_dictionary/right_paren
@@ -0,0 +1 @@
+) \ No newline at end of file
diff --git a/test/afl_dictionary/single_quote b/test/afl_dictionary/single_quote
new file mode 100644
index 0000000..ad2823b
--- /dev/null
+++ b/test/afl_dictionary/single_quote
@@ -0,0 +1 @@
+' \ No newline at end of file
diff --git a/test/afl_dictionary/string_any b/test/afl_dictionary/string_any
new file mode 100644
index 0000000..bcd7dd4
--- /dev/null
+++ b/test/afl_dictionary/string_any
@@ -0,0 +1 @@
+ANY \ No newline at end of file
diff --git a/test/afl_dictionary/string_brackets b/test/afl_dictionary/string_brackets
new file mode 100644
index 0000000..0637a08
--- /dev/null
+++ b/test/afl_dictionary/string_brackets
@@ -0,0 +1 @@
+[] \ No newline at end of file
diff --git a/test/afl_dictionary/string_cdata b/test/afl_dictionary/string_cdata
new file mode 100644
index 0000000..9d6d94e
--- /dev/null
+++ b/test/afl_dictionary/string_cdata
@@ -0,0 +1 @@
+CDATA \ No newline at end of file
diff --git a/test/afl_dictionary/string_dashes b/test/afl_dictionary/string_dashes
new file mode 100644
index 0000000..7489acc
--- /dev/null
+++ b/test/afl_dictionary/string_dashes
@@ -0,0 +1 @@
+-- \ No newline at end of file
diff --git a/test/afl_dictionary/string_empty_dblquotes b/test/afl_dictionary/string_empty_dblquotes
new file mode 100644
index 0000000..3cc762b
--- /dev/null
+++ b/test/afl_dictionary/string_empty_dblquotes
@@ -0,0 +1 @@
+"" \ No newline at end of file
diff --git a/test/afl_dictionary/string_empty_quotes b/test/afl_dictionary/string_empty_quotes
new file mode 100644
index 0000000..9423090
--- /dev/null
+++ b/test/afl_dictionary/string_empty_quotes
@@ -0,0 +1 @@
+'' \ No newline at end of file
diff --git a/test/afl_dictionary/string_idrefs b/test/afl_dictionary/string_idrefs
new file mode 100644
index 0000000..dd37f9c
--- /dev/null
+++ b/test/afl_dictionary/string_idrefs
@@ -0,0 +1 @@
+IDREFS \ No newline at end of file
diff --git a/test/afl_dictionary/string_parentheses b/test/afl_dictionary/string_parentheses
new file mode 100644
index 0000000..dd626a0
--- /dev/null
+++ b/test/afl_dictionary/string_parentheses
@@ -0,0 +1 @@
+() \ No newline at end of file
diff --git a/test/afl_dictionary/string_pcdata b/test/afl_dictionary/string_pcdata
new file mode 100644
index 0000000..d2dd7f7
--- /dev/null
+++ b/test/afl_dictionary/string_pcdata
@@ -0,0 +1 @@
+#PCDATA \ No newline at end of file
diff --git a/test/afl_dictionary/tag_cdata b/test/afl_dictionary/tag_cdata
new file mode 100644
index 0000000..fac6255
--- /dev/null
+++ b/test/afl_dictionary/tag_cdata
@@ -0,0 +1 @@
+<![CDATA[ \ No newline at end of file
diff --git a/test/afl_dictionary/tag_close b/test/afl_dictionary/tag_close
new file mode 100644
index 0000000..e8a17f4
--- /dev/null
+++ b/test/afl_dictionary/tag_close
@@ -0,0 +1 @@
+</a> \ No newline at end of file
diff --git a/test/afl_dictionary/tag_doctype b/test/afl_dictionary/tag_doctype
new file mode 100644
index 0000000..b771752
--- /dev/null
+++ b/test/afl_dictionary/tag_doctype
@@ -0,0 +1 @@
+<!DOCTYPE \ No newline at end of file
diff --git a/test/afl_dictionary/tag_element b/test/afl_dictionary/tag_element
new file mode 100644
index 0000000..04ad1f5
--- /dev/null
+++ b/test/afl_dictionary/tag_element
@@ -0,0 +1 @@
+<!ELEMENT \ No newline at end of file
diff --git a/test/afl_dictionary/tag_entity b/test/afl_dictionary/tag_entity
new file mode 100644
index 0000000..ee9f1f3
--- /dev/null
+++ b/test/afl_dictionary/tag_entity
@@ -0,0 +1 @@
+<!ENTITY \ No newline at end of file
diff --git a/test/afl_dictionary/tag_notation b/test/afl_dictionary/tag_notation
new file mode 100644
index 0000000..749f920
--- /dev/null
+++ b/test/afl_dictionary/tag_notation
@@ -0,0 +1 @@
+<!NOTATION \ No newline at end of file
diff --git a/test/afl_dictionary/tag_open b/test/afl_dictionary/tag_open
new file mode 100644
index 0000000..6411313
--- /dev/null
+++ b/test/afl_dictionary/tag_open
@@ -0,0 +1 @@
+<a> \ No newline at end of file
diff --git a/test/afl_dictionary/tag_open_close b/test/afl_dictionary/tag_open_close
new file mode 100644
index 0000000..4a12235
--- /dev/null
+++ b/test/afl_dictionary/tag_open_close
@@ -0,0 +1 @@
+<a /> \ No newline at end of file
diff --git a/test/afl_dictionary/tag_open_exclamation b/test/afl_dictionary/tag_open_exclamation
new file mode 100644
index 0000000..58adc03
--- /dev/null
+++ b/test/afl_dictionary/tag_open_exclamation
@@ -0,0 +1 @@
+<! \ No newline at end of file
diff --git a/test/afl_dictionary/tag_open_q b/test/afl_dictionary/tag_open_q
new file mode 100644
index 0000000..2b4439c
--- /dev/null
+++ b/test/afl_dictionary/tag_open_q
@@ -0,0 +1 @@
+<? \ No newline at end of file
diff --git a/test/afl_dictionary/tag_sq2_close b/test/afl_dictionary/tag_sq2_close
new file mode 100644
index 0000000..facf683
--- /dev/null
+++ b/test/afl_dictionary/tag_sq2_close
@@ -0,0 +1 @@
+]]> \ No newline at end of file
diff --git a/test/afl_dictionary/tag_xml_q b/test/afl_dictionary/tag_xml_q
new file mode 100644
index 0000000..be32990
--- /dev/null
+++ b/test/afl_dictionary/tag_xml_q
@@ -0,0 +1 @@
+<?xml?> \ No newline at end of file
diff --git a/test/afl_dictionary/underscore b/test/afl_dictionary/underscore
new file mode 100644
index 0000000..c9cdc63
--- /dev/null
+++ b/test/afl_dictionary/underscore
@@ -0,0 +1 @@
+_ \ No newline at end of file
diff --git a/test/cmark.py b/test/cmark.py
index 40e8c22..1110860 100644
--- a/test/cmark.py
+++ b/test/cmark.py
@@ -4,6 +4,7 @@
from ctypes import CDLL, c_char_p, c_long
from subprocess import *
import platform
+import os
def pipe_through_prog(prog, text):
p1 = Popen(prog.split(), stdout=PIPE, stdin=PIPE, stderr=PIPE)
@@ -22,17 +23,16 @@ class CMark:
self.to_html = lambda x: pipe_through_prog(prog, x)
else:
sysname = platform.system()
- libname = "libcmark"
if sysname == 'Darwin':
- libname += ".dylib"
+ libname = "libcmark.dylib"
elif sysname == 'Windows':
libname = "cmark.dll"
else:
- libname += ".so"
+ libname = "libcmark.so"
if library_dir:
- libpath = library_dir + "/" + libname
+ libpath = os.path.join(library_dir, libname)
else:
- libpath = "build/src/" + libname
+ libpath = os.path.join("build", "src", libname)
cmark = CDLL(libpath)
markdown = cmark.cmark_markdown_to_html
markdown.restype = c_char_p
diff --git a/test/spec.txt b/test/spec.txt
index ac47b1a..9b2b977 100644
--- a/test/spec.txt
+++ b/test/spec.txt
@@ -1,8 +1,8 @@
---
title: CommonMark Spec
author: John MacFarlane
-version: 0.18
-date: 2015-03-03
+version: 0.19
+date: 2015-04-27
license: '[CC-BY-SA 4.0](http://creativecommons.org/licenses/by-sa/4.0/)'
...
@@ -192,8 +192,8 @@ an implementation without writing an abstract syntax tree renderer.
This document is generated from a text file, `spec.txt`, written
in Markdown with a small extension for the side-by-side tests.
-The script `spec2md.pl` can be used to turn `spec.txt` into pandoc
-Markdown, which can then be converted into other formats.
+The script `tools/makespec.py` can be used to convert `spec.txt` into
+HTML or CommonMark (which can then be converted into other formats).
In the examples, the `→` character is used to represent tabs.
@@ -569,8 +569,11 @@ prevent things like the following from being parsed as headers:
.
#5 bolt
+
+#foobar
.
<p>#5 bolt</p>
+<p>#foobar</p>
.
This is not a header, because the first `#` is escaped:
@@ -724,13 +727,14 @@ ATX headers can be empty:
## Setext headers
A [setext header](@setext-header)
-consists of a line of text, containing at least one
-[non-space character],
+consists of a line of text, containing at least one [non-space character],
with no more than 3 spaces indentation, followed by a [setext header
underline]. The line of text must be
one that, were it not followed by the setext header underline,
-would be interpreted as part of a paragraph: it cannot be a code
-block, header, blockquote, horizontal rule, or list.
+would be interpreted as part of a paragraph: it cannot be
+interpretable as a [code fence], [ATX header][ATX headers],
+[block quote][block quotes], [horizontal rule][horizontal rules],
+[list item][list items], or [HTML block][HTML blocks].
A [setext header underline](@setext-header-underline) is a sequence of
`=` characters or a sequence of `-` characters, with no more than 3
@@ -1811,7 +1815,7 @@ title], which if it is present must be separated
from the [link destination] by [whitespace].
No further [non-space character]s may occur on the line.
-A [link reference-definition]
+A [link reference definition]
does not correspond to a structural element of a document. Instead, it
defines a label which can be used in [reference link]s
and reference-style [images] elsewhere in the document. [Link
@@ -2587,7 +2591,7 @@ The following rules define [list items]:
1. **Basic case.** If a sequence of lines *Ls* constitute a sequence of
blocks *Bs* starting with a [non-space character] and not separated
from each other by more than one blank line, and *M* is a list
- marker *M* of width *W* followed by 0 < *N* < 5 spaces, then the result
+ marker of width *W* followed by 0 < *N* < 5 spaces, then the result
of prepending *M* and the following spaces to the first line of
*Ls*, and indenting subsequent lines of *Ls* by *W + N* spaces, is a
list item with *Bs* as its contents. The type of the list item
@@ -2726,7 +2730,7 @@ this example:
Here `two` occurs in the same column as the list marker `1.`,
but is actually contained in the list item, because there is
-sufficent indentation after the last containing blockquote marker.
+sufficient indentation after the last containing blockquote marker.
The converse is also possible. In the following example, the word `two`
occurs far to the right of the initial text of the list item, `one`, but
@@ -2852,7 +2856,7 @@ A list item may contain any kind of block:
2. **Item starting with indented code.** If a sequence of lines *Ls*
constitute a sequence of blocks *Bs* starting with an indented code
block and not separated from each other by more than one blank line,
- and *M* is a list marker *M* of width *W* followed by
+ and *M* is a list marker of width *W* followed by
one space, then the result of prepending *M* and the following
space to the first line of *Ls*, and indenting subsequent lines of
*Ls* by *W + 1* spaces, is a list item with *Bs* as its contents.
@@ -3001,7 +3005,7 @@ the above case:
3. **Item starting with a blank line.** If a sequence of lines *Ls*
starting with a single [blank line] constitute a (possibly empty)
sequence of blocks *Bs*, not separated from each other by more than
- one blank line, and *M* is a list marker *M* of width *W*,
+ one blank line, and *M* is a list marker of width *W*,
then the result of prepending *M* to the first line of *Ls*, and
indenting subsequent lines of *Ls* by *W + 1* spaces, is a list
item with *Bs* as its contents.
@@ -3090,7 +3094,7 @@ A list may start or end with an empty list item:
4. **Indentation.** If a sequence of lines *Ls* constitutes a list item
according to rule #1, #2, or #3, then the result of indenting each line
- of *L* by 1-3 spaces (the same for each line) also constitutes a
+ of *Ls* by 1-3 spaces (the same for each line) also constitutes a
list item with the same contents and attributes. If a line is
empty, then it need not be indented.
@@ -3834,9 +3838,11 @@ item:
- b
- c
- d
- - e
- - f
-- g
+ - e
+ - f
+ - g
+ - h
+- i
.
<ul>
<li>a</li>
@@ -3846,6 +3852,8 @@ item:
<li>e</li>
<li>f</li>
<li>g</li>
+<li>h</li>
+<li>i</li>
</ul>
.
@@ -4275,8 +4283,8 @@ corresponding codepoints.
[Decimal entities](@decimal-entities)
consist of `&#` + a string of 1--8 arabic digits + `;`. Again, these
-entities need to be recognised and tranformed into their corresponding
-UTF8 codepoints. Invalid Unicode codepoints will be written as the
+entities need to be recognised and transformed into their corresponding
+unicode codepoints. Invalid unicode codepoints will be written as the
"unknown codepoint" character (`0xFFFD`)
.
@@ -4287,7 +4295,8 @@ UTF8 codepoints. Invalid Unicode codepoints will be written as the
[Hexadecimal entities](@hexadecimal-entities)
consist of `&#` + either `X` or `x` + a string of 1-8 hexadecimal digits
-+ `;`. They will also be parsed and turned into their corresponding UTF8 values in the AST.
++ `;`. They will also be parsed and turned into the corresponding
+unicode codepoints in the AST.
.
&#X22; &#XD06; &#xcab;
@@ -4581,14 +4590,16 @@ characters that is not preceded or followed by a `_` character.
A [left-flanking delimiter run](@left-flanking-delimiter-run) is
a [delimiter run] that is (a) not followed by [unicode whitespace],
and (b) either not followed by a [punctuation character], or
-preceded by [unicode whitespace] or a [punctuation character] or
-the beginning of a line.
+preceded by [unicode whitespace] or a [punctuation character].
+For purposes of this definition, the beginning and the end of
+the line count as unicode whitespace.
A [right-flanking delimiter run](@right-flanking-delimiter-run) is
a [delimiter run] that is (a) not preceded by [unicode whitespace],
and (b) either not preceded by a [punctuation character], or
-followed by [unicode whitespace] or a [punctuation character] or
-the end of a line.
+followed by [unicode whitespace] or a [punctuation character].
+For purposes of this definition, the beginning and the end of
+the line count as unicode whitespace.
Here are some examples of delimiter runs.
@@ -4604,20 +4615,20 @@ Here are some examples of delimiter runs.
- right-flanking but not left-flanking:
```
- abc***
- abc_
+ abc***
+ abc_
"abc"**
- _"abc"
+ "abc"_
```
- - Both right and right-flanking:
+ - Both left and right-flanking:
```
- abc***def
+ abc***def
"abc"_"def"
```
- - Neither right nor right-flanking:
+ - Neither left nor right-flanking:
```
abc *** def
@@ -4635,32 +4646,40 @@ are a bit more complex than the ones given here.)
The following rules define emphasis and strong emphasis:
1. A single `*` character [can open emphasis](@can-open-emphasis)
- iff it is part of a [left-flanking delimiter run].
+ iff (if and only if) it is part of a [left-flanking delimiter run].
2. A single `_` character [can open emphasis] iff
it is part of a [left-flanking delimiter run]
- and not part of a [right-flanking delimiter run].
+ and either (a) not part of a [right-flanking delimiter run]
+ or (b) part of a [right-flanking delimeter run]
+ preceded by punctuation.
3. A single `*` character [can close emphasis](@can-close-emphasis)
iff it is part of a [right-flanking delimiter run].
-4. A single `_` character [can close emphasis]
- iff it is part of a [right-flanking delimiter run]
- and not part of a [left-flanking delimiter run].
+4. A single `_` character [can close emphasis] iff
+ it is part of a [right-flanking delimiter run]
+ and either (a) not part of a [left-flanking delimiter run]
+ or (b) part of a [left-flanking delimeter run]
+ followed by punctuation.
5. A double `**` [can open strong emphasis](@can-open-strong-emphasis)
iff it is part of a [left-flanking delimiter run].
-6. A double `__` [can open strong emphasis]
- iff it is part of a [left-flanking delimiter run]
- and not part of a [right-flanking delimiter run].
+6. A double `__` [can open strong emphasis] iff
+ it is part of a [left-flanking delimiter run]
+ and either (a) not part of a [right-flanking delimiter run]
+ or (b) part of a [right-flanking delimeter run]
+ preceded by punctuation.
7. A double `**` [can close strong emphasis](@can-close-strong-emphasis)
iff it is part of a [right-flanking delimiter run].
8. A double `__` [can close strong emphasis]
- iff it is part of a [right-flanking delimiter run]
- and not part of a [left-flanking delimiter run].
+ it is part of a [right-flanking delimiter run]
+ and either (a) not part of a [left-flanking delimiter run]
+ or (b) part of a [left-flanking delimeter run]
+ followed by punctuation.
9. Emphasis begins with a delimiter that [can open emphasis] and ends
with a delimiter that [can close emphasis], and that uses the same
@@ -4822,13 +4841,14 @@ aa_"bb"_cc
<p>aa_&quot;bb&quot;_cc</p>
.
-Here there is no emphasis, because the delimiter runs are
-both left- and right-flanking:
+This is emphasis, even though the opening delimiter is
+both left- and right-flanking, because it is preceded by
+punctuation:
.
-"aa"_"bb"_"cc"
+foo-_(bar)_
.
-<p>&quot;aa&quot;_&quot;bb&quot;_&quot;cc&quot;</p>
+<p>foo-<em>(bar)</em></p>
.
Rule 3:
@@ -4939,6 +4959,16 @@ _foo_bar_baz_
<p><em>foo_bar_baz</em></p>
.
+This is emphasis, even though the closing delimiter is
+both left- and right-flanking, because it is followed by
+punctuation:
+
+.
+_(bar)_.
+.
+<p><em>(bar)</em>.</p>
+.
+
Rule 5:
.
@@ -5035,6 +5065,17 @@ __foo, __bar__, baz__
<p><strong>foo, <strong>bar</strong>, baz</strong></p>
.
+This is strong emphasis, even though the opening delimiter is
+both left- and right-flanking, because it is preceded by
+punctuation:
+
+.
+foo-__(bar)__
+.
+<p>foo-<strong>(bar)</strong></p>
+.
+
+
Rule 7:
This is not strong emphasis, because the closing delimiter is preceded
@@ -5138,6 +5179,16 @@ __foo__bar__baz__
<p><strong>foo__bar__baz</strong></p>
.
+This is strong emphasis, even though the closing delimiter is
+both left- and right-flanking, because it is followed by
+punctuation:
+
+.
+__(bar)__.
+.
+<p><strong>(bar)</strong>.</p>
+.
+
Rule 9:
Any nonempty sequence of inline elements can be the contents of an
@@ -5706,7 +5757,7 @@ A [link destination](@link-destination) consists of either
ASCII space or control characters, and includes parentheses
only if (a) they are backslash-escaped or (b) they are part of
a balanced pair of unescaped parentheses that is not itself
- inside a balanced pair of unescaped paretheses.
+ inside a balanced pair of unescaped parentheses.
A [link title](@link-title) consists of either
@@ -5839,8 +5890,8 @@ in Markdown:
URL-escaping should be left alone inside the destination, as all
URL-escaped characters are also valid URL characters. HTML entities in
-the destination will be parsed into their UTF-8 codepoints, as usual, and
-optionally URL-escaped when written as HTML.
+the destination will be parsed into the corresponding unicode
+codepoints, as usual, and optionally URL-escaped when written as HTML.
.
[link](foo%20b&auml;)
@@ -7215,10 +7266,10 @@ foo
## Soft line breaks
A regular line break (not in a code span or HTML tag) that is not
-preceded by two or more spaces is parsed as a softbreak. (A
-softbreak may be rendered in HTML either as a
-[line ending] or as a space. The result will be the same
-in browsers. In the examples here, a [line ending] will be used.)
+preceded by two or more spaces or a backslash is parsed as a
+softbreak. (A softbreak may be rendered in HTML either as a
+[line ending] or as a space. The result will be the same in
+browsers. In the examples here, a [line ending] will be used.)
.
foo