A platform for community discussion. Free, open, simple.
DEV: Update markdown-it from 14.0.0 to 14.1.1 (#38869)
Jarek Radosz9653385e94bc
diff --git a/frontend/discourse-markdown-it/package.json b/frontend/discourse-markdown-it/package.jsonindex 0a6aac8d8cf..0240e6c24fa 100644--- a/frontend/discourse-markdown-it/package.json+++ b/frontend/discourse-markdown-it/package.json@@ -21,7 +21,7 @@"@embroider/addon-shim": "^1.9.0","discourse-i18n": "workspace:1.0.0","ember-auto-import": "^2.12.1",- "markdown-it": "14.0.0",+ "markdown-it": "^14.1.1","pretty-text": "workspace:1.0.0","xss": "^1.0.15"},diff --git a/plugins/chat/spec/models/chat/message_spec.rb b/plugins/chat/spec/models/chat/message_spec.rbindex 759b87f905b..50573e7bb18 100644--- a/plugins/chat/spec/models/chat/message_spec.rb+++ b/plugins/chat/spec/models/chat/message_spec.rb@@ -634,7 +634,9 @@ describe Chat::Message douser = Fabricate(:unicode_user)cooked = described_class.cook("<h1>@#{user.username}</h1>")- expect(cooked).to eq("<p><h1>@#{user.username}</h1></p>")+ expect(cooked).to eq(+ "<p><h1><a class=\"mention\" href=\"/u/#{user.encoded_username(lower: true)}\">@#{user.username}</a></h1></p>",+ )endendenddiff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex b5129f35e96..46f030798e9 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -654,8 +654,8 @@ importers:specifier: ^2.12.1version: 2.12.1(@glint/[email protected])([email protected](@swc/[email protected])([email protected]))markdown-it:- specifier: 14.0.0- version: 14.0.0+ specifier: ^14.1.1+ version: 14.1.1pretty-text:specifier: workspace:1.0.0version: link:../pretty-text@@ -6912,10 +6912,6 @@ packages:peerDependencies:markdown-it: '>= 13.0.0'- resolution: {integrity: sha512-seFjF0FIcPt4P9U39Bq1JYblX0KZCjDLFFQPHpL5AzHpqPEKtosxmdq/LTVZnjfH7tjt9BxStm+wXcDBNuYmzw==}- hasBin: true-resolution: {integrity: sha512-BuU2qnTti9YKgK5N+IeMubp14ZUKUUw7yeJbkjtosvHiP0AZ5c8IAgEMk79D0eC8F23r4Ac/q8cAIFdm2FtyoA==}hasBin: true@@ -16967,15 +16963,6 @@ snapshots:lodash.merge: 4.6.2markdown-it: 14.1.1- dependencies:- argparse: 2.0.1- entities: 4.5.0- linkify-it: 5.0.0- mdurl: 2.0.0- punycode.js: 2.3.1- uc.micro: 2.1.0-dependencies:argparse: 2.0.1@@ -17974,7 +17961,7 @@ snapshots:dependencies:'@types/markdown-it': 14.1.2- markdown-it: 14.0.0+ markdown-it: 14.1.1prosemirror-model: 1.25.4diff --git a/spec/fixtures/md/spec.txt b/spec/fixtures/md/spec.txtindex 66cb1caec91..8f519fe28a4 100644--- a/spec/fixtures/md/spec.txt+++ b/spec/fixtures/md/spec.txt@@ -1,8 +1,8 @@---title: CommonMark Specauthor: John MacFarlane-version: 0.29-date: '2019-04-06'+version: 0.31.2+date: '2024-01-28'license: '[CC-BY-SA 4.0](http://creativecommons.org/licenses/by-sa/4.0/)'...@@ -14,7 +14,7 @@ Markdown is a plain text format for writing structured documents,based on conventions for indicating formatting in emailand usenet posts. It was developed by John Gruber (withhelp from Aaron Swartz) and released in 2004 in the form of a-[syntax description](http://daringfireball.net/projects/markdown/syntax)+[syntax description](https://daringfireball.net/projects/markdown/syntax)and a Perl script (`Markdown.pl`) for converting Markdown toHTML. In the next decade, dozens of implementations weredeveloped in many languages. Some extended the original@@ -34,10 +34,10 @@ As Gruber writes:> Markdown-formatted document should be publishable as-is, as> plain text, without looking like it's been marked up with tags> or formatting instructions.-> (<http://daringfireball.net/projects/markdown/>)+> (<https://daringfireball.net/projects/markdown/>)The point can be illustrated by comparing a sample of-[AsciiDoc](http://www.methods.co.nz/asciidoc/) with+[AsciiDoc](https://asciidoc.org/) withan equivalent sample of Markdown. Here is a sample ofAsciiDoc from the AsciiDoc manual:@@ -103,7 +103,7 @@ source, not just in the processed document.## Why is a spec needed?John Gruber's [canonical description of Markdown's-syntax](http://daringfireball.net/projects/markdown/syntax)+syntax](https://daringfireball.net/projects/markdown/syntax)does not specify the syntax unambiguously. Here are some examples ofquestions it does not answer:@@ -114,7 +114,7 @@ questions it does not answer:not require that. This is hardly a "corner case," and divergencesbetween implementations on this issue often lead to surprises forusers in real documents. (See [this comment by John- Gruber](http://article.gmane.org/gmane.text.markdown.general/1997).)+ Gruber](https://web.archive.org/web/20170611172104/http://article.gmane.org/gmane.text.markdown.general/1997).)2. Is a blank line needed before a block quote or heading?Most implementations do not require the blank line. However,@@ -122,7 +122,7 @@ questions it does not answer:also to ambiguities in parsing (note that some implementationsput the heading inside the blockquote, while others do not).(John Gruber has also spoken [in favor of requiring the blank- lines](http://article.gmane.org/gmane.text.markdown.general/2146).)+ lines](https://web.archive.org/web/20170611172104/http://article.gmane.org/gmane.text.markdown.general/2146).)3. Is a blank line needed before an indented code block?(`Markdown.pl` requires it, but this is not mentioned in the@@ -155,7 +155,7 @@ questions it does not answer:```(There are some relevant comments by John Gruber- [here](http://article.gmane.org/gmane.text.markdown.general/2554).)+ [here](https://web.archive.org/web/20170611172104/http://article.gmane.org/gmane.text.markdown.general/2554).)5. Can list markers be indented? Can ordered list markers be right-aligned?@@ -270,6 +270,16 @@ of representing the structural distinctions we need to make, and thechoice of HTML for the tests makes it possible to run the tests againstan implementation without writing an abstract syntax tree renderer.+Note that not every feature of the HTML samples is mandated by+the spec. For example, the spec says what counts as a link+destination, but it doesn't mandate that non-ASCII characters in+the URL be percent-encoded. To use the automatic tests,+implementers will need to provide a renderer that conforms to+the expectations of the spec examples (percent-encoding+non-ASCII characters in URLs). But a conforming implementation+can use a different renderer and may choose not to+percent-encode non-ASCII characters in URLs.+This document is generated from a text file, `spec.txt`, writtenin Markdown with a small extension for the side-by-side tests.The script `tools/makespec.py` can be used to convert `spec.txt` into@@ -294,38 +304,29 @@ of [characters] rather than bytes. A conforming parser may be limitedto a certain encoding.A [line](@) is a sequence of zero or more [characters]-other than newline (`U+000A`) or carriage return (`U+000D`),+other than line feed (`U+000A`) or carriage return (`U+000D`),followed by a [line ending] or by the end of file.-A [line ending](@) is a newline (`U+000A`), a carriage return-(`U+000D`) not followed by a newline, or a carriage return and a-following newline.+A [line ending](@) is a line feed (`U+000A`), a carriage return+(`U+000D`) not followed by a line feed, or a carriage return and a+following line feed.A line containing no characters, or a line containing only spaces(`U+0020`) or tabs (`U+0009`), is called a [blank line](@).The following definitions of character classes will be used in this spec:-A [whitespace character](@) is a space-(`U+0020`), tab (`U+0009`), newline (`U+000A`), line tabulation (`U+000B`),-form feed (`U+000C`), or carriage return (`U+000D`).--[Whitespace](@) is a sequence of one or more [whitespace-characters].+A [Unicode whitespace character](@) is a character in the Unicode `Zs` general+category, or a tab (`U+0009`), line feed (`U+000A`), form feed (`U+000C`), or+carriage return (`U+000D`).-A [Unicode whitespace character](@) is-any code point in the Unicode `Zs` general category, or a tab (`U+0009`),-carriage return (`U+000D`), newline (`U+000A`), or form feed-(`U+000C`).+[Unicode whitespace](@) is a sequence of one or more+[Unicode whitespace characters].-[Unicode whitespace](@) is a sequence of one-or more [Unicode whitespace characters].+A [tab](@) is `U+0009`.A [space](@) is `U+0020`.-A [non-whitespace character](@) is any character-that is not a [whitespace character].-An [ASCII control character](@) is a character between `U+0000–1F` (bothincluding) or `U+007F`.@@ -336,14 +337,13 @@ is `!`, `"`, `#`, `$`, `%`, `&`, `'`, `(`, `)`,`[`, `\`, `]`, `^`, `_`, `` ` `` (U+005B–0060),`{`, `|`, `}`, or `~` (U+007B–007E).-A [punctuation character](@) is an [ASCII-punctuation character] or anything in-the general Unicode categories `Pc`, `Pd`, `Pe`, `Pf`, `Pi`, `Po`, or `Ps`.+A [Unicode punctuation character](@) is a character in the Unicode `P`+(puncuation) or `S` (symbol) general categories.## TabsTabs in lines are not expanded to [spaces]. However,-in contexts where whitespace helps to define block structure,+in contexts where spaces help to define block structure,tabs behave as if they were replaced by spaces with a tab stopof 4 characters.@@ -578,9 +578,9 @@ raw HTML:```````````````````````````````` example-<http://example.com?find=\*>+<https://example.com?find=\*>.-<p><a href="http://example.com?find=%5C*">http://example.com?find=\*</a></p>+<p><a href="https://example.com?find=%5C*">https://example.com?find=\*</a></p>````````````````````````````````@@ -642,7 +642,7 @@ using a Unicode character or an entity reference.[Entity references](@) consist of `&` + any of the validHTML5 entity names + `;`. The-document <https://html.spec.whatwg.org/multipage/entities.json>+document <https://html.spec.whatwg.org/entities.json>is used as an authoritative source for the valid entityreferences and their corresponding code points.@@ -860,8 +860,8 @@ one block element does not affect the inline parsing of any other.## Container blocks and leaf blocksWe can divide blocks into two types:-[container blocks](@),-which can contain other blocks, and [leaf blocks](@),+[container blocks](#container-blocks),+which can contain other blocks, and [leaf blocks](#leaf-blocks),which cannot.# Leaf blocks@@ -871,8 +871,8 @@ Markdown document.## Thematic breaks-A line consisting of 0-3 spaces of indentation, followed by a sequence-of three or more matching `-`, `_`, or `*` characters, each followed+A line consisting of optionally up to three spaces of indentation, followed by a+sequence of three or more matching `-`, `_`, or `*` characters, each followedoptionally by any number of spaces or tabs, forms a[thematic break](@).@@ -916,7 +916,7 @@ __</p>````````````````````````````````-One to three spaces indent are allowed:+Up to three spaces of indentation are allowed:```````````````````````````````` example***@@ -929,7 +929,7 @@ One to three spaces indent are allowed:````````````````````````````````-Four spaces is too many:+Four spaces of indentation is too many:```````````````````````````````` example***@@ -957,7 +957,7 @@ _____________________________________````````````````````````````````-Spaces are allowed between the characters:+Spaces and tabs are allowed between the characters:```````````````````````````````` example- - -@@ -980,7 +980,7 @@ Spaces are allowed between the characters:````````````````````````````````-Spaces are allowed at the end:+Spaces and tabs are allowed at the end:```````````````````````````````` example- - - -@@ -1004,7 +1004,7 @@ a------````````````````````````````````-It is required that all of the [non-whitespace characters] be the same.+It is required that all of the characters other than spaces or tabs be the same.So, this is not a thematic break:```````````````````````````````` example@@ -1099,13 +1099,13 @@ An [ATX heading](@)consists of a string of characters, parsed as inline content, between anopening sequence of 1--6 unescaped `#` characters and an optionalclosing sequence of any number of unescaped `#` characters.-The opening sequence of `#` characters must be followed by a-[space] or by the end of line. The optional closing sequence of `#`s must be-preceded by a [space] and may be followed by spaces only. The opening-`#` character may be indented 0-3 spaces. The raw contents of the-heading are stripped of leading and trailing spaces before being parsed-as inline content. The heading level is equal to the number of `#`-characters in the opening sequence.+The opening sequence of `#` characters must be followed by spaces or tabs, or+by the end of line. The optional closing sequence of `#`s must be preceded by+spaces or tabs and may be followed by spaces or tabs only. The opening+`#` character may be preceded by up to three spaces of indentation. The raw+contents of the heading are stripped of leading and trailing space or tabs+before being parsed as inline content. The heading level is equal to the number+of `#` characters in the opening sequence.Simple headings:@@ -1135,7 +1135,7 @@ More than six `#` characters is not a heading:````````````````````````````````-At least one space is required between the `#` characters and the+At least one space or tab is required between the `#` characters and theheading's contents, unless the heading is empty. Note that manyimplementations currently do not require the space. However, thespace was required by the@@ -1171,7 +1171,7 @@ Contents are parsed as inlines:````````````````````````````````-Leading and trailing [whitespace] is ignored in parsing inline content:+Leading and trailing spaces or tabs are ignored in parsing inline content:```````````````````````````````` example# foo@@ -1180,7 +1180,7 @@ Leading and trailing [whitespace] is ignored in parsing inline content:````````````````````````````````-One to three spaces indentation are allowed:+Up to three spaces of indentation are allowed:```````````````````````````````` example### foo@@ -1193,7 +1193,7 @@ One to three spaces indentation are allowed:````````````````````````````````-Four spaces are too much:+Four spaces of indentation is too many:```````````````````````````````` example# foo@@ -1234,7 +1234,7 @@ It need not be the same length as the opening sequence:````````````````````````````````-Spaces are allowed after the closing sequence:+Spaces or tabs are allowed after the closing sequence:```````````````````````````````` example### foo ###@@ -1243,7 +1243,7 @@ Spaces are allowed after the closing sequence:````````````````````````````````-A sequence of `#` characters with anything but [spaces] following it+A sequence of `#` characters with anything but spaces or tabs following itis not a closing sequence, but counts as part of the contents of theheading:@@ -1254,7 +1254,7 @@ heading:````````````````````````````````-The closing sequence must be preceded by a space:+The closing sequence must be preceded by a space or tab:```````````````````````````````` example# foo#@@ -1318,8 +1318,8 @@ ATX headings can be empty:## Setext headingsA [setext heading](@) consists of one or more-lines of text, each containing at least one [non-whitespace-character], with no more than 3 spaces indentation, followed by+lines of text, not interrupted by a blank line, of which the first line does not+have more than 3 spaces of indentation, followed bya [setext heading underline]. The lines of text must be suchthat, were they not followed by the setext heading underline,they would be interpreted as a paragraph: they cannot be@@ -1329,10 +1329,7 @@ interpretable as a [code fence], [ATX heading][ATX headings],A [setext heading underline](@) is a sequence of`=` characters or a sequence of `-` characters, with no more than 3-spaces indentation and any number of trailing spaces. If a line-containing a single `-` can be interpreted as an-empty [list items], it should be interpreted this way-and not as a [setext heading underline].+spaces of indentation and any number of trailing spaces or tabs.The heading is a level 1 heading if `=` characters are used inthe [setext heading underline], and a level 2 heading if `-`@@ -1373,7 +1370,7 @@ baz</em></h1>The contents are the result of parsing the headings's rawcontent as inlines. The heading's raw content is formed byconcatenating the lines and removing initial and final-[whitespace].+spaces or tabs.```````````````````````````````` exampleFoo *bar@@ -1399,8 +1396,8 @@ Foo````````````````````````````````-The heading content can be indented up to three spaces, and need-not line up with the underlining:+The heading content can be preceded by up to three spaces of indentation, and+need not line up with the underlining:```````````````````````````````` exampleFoo@@ -1418,7 +1415,7 @@ not line up with the underlining:````````````````````````````````-Four spaces indent is too much:+Four spaces of indentation is too many:```````````````````````````````` exampleFoo@@ -1436,8 +1433,8 @@ Foo````````````````````````````````-The setext heading underline can be indented up to three spaces, and-may have trailing spaces:+The setext heading underline can be preceded by up to three spaces of+indentation, and may have trailing spaces or tabs:```````````````````````````````` exampleFoo@@ -1447,7 +1444,7 @@ Foo````````````````````````````````-Four spaces is too much:+Four spaces of indentation is too many:```````````````````````````````` exampleFoo@@ -1458,7 +1455,7 @@ Foo````````````````````````````````-The setext heading underline cannot contain internal spaces:+The setext heading underline cannot contain internal spaces or tabs:```````````````````````````````` exampleFoo@@ -1474,7 +1471,7 @@ Foo````````````````````````````````-Trailing spaces in the content line do not cause a line break:+Trailing spaces or tabs in the content line do not cause a hard line break:```````````````````````````````` exampleFoo@@ -1739,8 +1736,8 @@ baz</p>An [indented code block](@) is composed of one or more[indented chunks] separated by blank lines.An [indented chunk](@) is a sequence of non-blank lines,-each indented four or more spaces. The contents of the code block are-the literal contents of the lines, including trailing+each preceded by four or more spaces of indentation. The contents of the code+block are the literal contents of the lines, including trailing[line endings], minus four spaces of indentation.An indented code block has no [info string].@@ -1833,8 +1830,8 @@ chunk3````````````````````````````````-Any initial spaces beyond four will be included in the content, even-in interior blank lines:+Any initial spaces or tabs beyond four spaces of indentation will be included in+the content, even in interior blank lines:```````````````````````````````` examplechunk1@@ -1861,7 +1858,7 @@ bar</p>````````````````````````````````-However, any non-blank line with fewer than four leading spaces ends+However, any non-blank line with fewer than four spaces of indentation endsthe code block immediately. So a paragraph may occur immediatelyafter indented code:@@ -1896,7 +1893,7 @@ Heading````````````````````````````````-The first line can be indented more than four spaces:+The first line can be preceded by more than four spaces of indentation:```````````````````````````````` examplefoo@@ -1923,7 +1920,7 @@ are not included in it:````````````````````````````````-Trailing spaces are included in the code block's content:+Trailing spaces or tabs are included in the code block's content:```````````````````````````````` examplefoo@@ -1940,11 +1937,11 @@ A [code fence](@) is a sequenceof at least three consecutive backtick characters (`` ` ``) ortildes (`~`). (Tildes and backticks cannot be mixed.)A [fenced code block](@)-begins with a code fence, indented no more than three spaces.+begins with a code fence, preceded by up to three spaces of indentation.The line with the opening code fence may optionally contain some textfollowing the code fence; this is trimmed of leading and trailing-whitespace and called the [info string](@). If the [info string] comes+spaces or tabs and called the [info string](@). If the [info string] comesafter a backtick fence, it may not contain any backtickcharacters. (The reason for this restriction is that otherwisesome inline code would be incorrectly interpreted as the@@ -1954,19 +1951,19 @@ The content of the code block consists of all subsequent lines, untila closing [code fence] of the same type as the code blockbegan with (backticks or tildes), and with at least as many backticksor tildes as the opening code fence. If the leading code fence is-indented N spaces, then up to N spaces of indentation are removed from-each line of the content (if present). (If a content line is not-indented, it is preserved unchanged. If it is indented less than N-spaces, all of the indentation is removed.)+preceded by N spaces of indentation, then up to N spaces of indentation are+removed from each line of the content (if present). (If a content line is not+indented, it is preserved unchanged. If it is indented N spaces or less, all+of the indentation is removed.)-The closing code fence may be indented up to three spaces, and may be-followed only by spaces, which are ignored. If the end of the+The closing code fence may be preceded by up to three spaces of indentation, and+may be followed only by spaces or tabs, which are ignored. If the end of thecontaining block (or document) is reached and no closing code fencehas been found, the code block contains all of the lines after theopening code fence until the end of the containing block (ordocument). (An alternative spec would require backtracking in theevent that a closing code fence is not found. But this makes parsing-much less efficient, and there seems to be no real down side to the+much less efficient, and there seems to be no real downside to thebehavior described here.)A fenced code block may interrupt a paragraph, and does not require@@ -2173,7 +2170,7 @@ aaa````````````````````````````````-Four spaces indentation produces an indented code block:+Four spaces of indentation is too many:```````````````````````````````` example```@@ -2187,8 +2184,8 @@ aaa````````````````````````````````-Closing fences may be indented by 0-3 spaces, and their indentation-need not match that of the opening fence:+Closing fences may be preceded by up to three spaces of indentation, and their+indentation need not match that of the opening fence:```````````````````````````````` example```@@ -2224,7 +2221,7 @@ aaa-Code fences (opening and closing) cannot contain internal spaces:+Code fences (opening and closing) cannot contain internal spaces or tabs:```````````````````````````````` example``` ```@@ -2367,19 +2364,19 @@ as raw HTML (and will not be escaped in HTML output).There are seven kinds of [HTML block], which can be defined by theirstart and end conditions. The block begins with a line that meets a-[start condition](@) (after up to three spaces optional indentation).-It ends with the first subsequent line that meets a matching [end-condition](@), or the last line of the document, or the last line of+[start condition](@) (after up to three optional spaces of indentation).+It ends with the first subsequent line that meets a matching+[end condition](@), or the last line of the document, or the last line ofthe [container block](#container-blocks) containing the current HTMLblock, if no line is encountered that meets the [end condition]. Ifthe first line meets both the [start condition] and the [endcondition], the block will contain just that line.-1. **Start condition:** line begins with the string `<script`,-`<pre`, or `<style` (case-insensitive), followed by whitespace,-the string `>`, or the end of the line.\+1. **Start condition:** line begins with the string `<pre`,+`<script`, `<style`, or `<textarea` (case-insensitive), followed by a space,+a tab, the string `>`, or the end of the line.\**End condition:** line contains an end tag-`</script>`, `</pre>`, or `</style>` (case-insensitive; it+`</pre>`, `</script>`, `</style>`, or `</textarea>` (case-insensitive; itneed not match the start tag).2. **Start condition:** line begins with the string `<!--`.\@@ -2389,14 +2386,14 @@ need not match the start tag).**End condition:** line contains the string `?>`.4. **Start condition:** line begins with the string `<!`-followed by an uppercase ASCII letter.\+followed by an ASCII letter.\**End condition:** line contains the character `>`.5. **Start condition:** line begins with the string`<![CDATA[`.\**End condition:** line contains the string `]]>`.-6. **Start condition:** line begins the string `<` or `</`+6. **Start condition:** line begins with the string `<` or `</`followed by one of the strings (case-insensitive) `address`,`article`, `aside`, `base`, `basefont`, `blockquote`, `body`,`caption`, `center`, `col`, `colgroup`, `dd`, `details`, `dialog`,@@ -2405,16 +2402,16 @@ followed by one of the strings (case-insensitive) `address`,`h1`, `h2`, `h3`, `h4`, `h5`, `h6`, `head`, `header`, `hr`,`html`, `iframe`, `legend`, `li`, `link`, `main`, `menu`, `menuitem`,`nav`, `noframes`, `ol`, `optgroup`, `option`, `p`, `param`,-`section`, `source`, `summary`, `table`, `tbody`, `td`,+`search`, `section`, `summary`, `table`, `tbody`, `td`,`tfoot`, `th`, `thead`, `title`, `tr`, `track`, `ul`, followed-by [whitespace], the end of the line, the string `>`, or+by a space, a tab, the end of the line, the string `>`, orthe string `/>`.\**End condition:** line is followed by a [blank line].7. **Start condition:** line begins with a complete [open tag]-(with any [tag name] other than `script`,-`style`, or `pre`) or a complete [closing tag],-followed only by [whitespace] or the end of the line.\+(with any [tag name] other than `pre`, `script`,+`style`, or `textarea`) or a complete [closing tag],+followed by zero or more spaces and tabs, followed by the end of the line.\**End condition:** line is followed by a [blank line].HTML blocks continue until they are closed by their appropriate@@ -2424,7 +2421,7 @@ block** that might otherwise be recognised as a start condition willbe ignored by the parser and passed through as-is, without changingthe parser's state.-For instance, `<pre>` within a HTML block started by `<table>` will not affect+For instance, `<pre>` within an HTML block started by `<table>` will not affectthe parser state; as the HTML block was started in by start condition 6, itwill end at any blank line. This can be surprising:@@ -2445,7 +2442,7 @@ _world_.</td></tr></table>````````````````````````````````-In this case, the HTML block is terminated by the newline — the `**Hello**`+In this case, the HTML block is terminated by the blank line — the `**Hello**`text remains verbatim — and regular parsing resumes, with a paragraph,emphasised `world` and inline and block HTML following.@@ -2723,7 +2720,7 @@ rather than an [HTML block].)HTML tags designed to contain literal content-(`script`, `style`, `pre`), comments, processing instructions,+(`pre`, `script`, `style`, `textarea`), comments, processing instructions,and declarations are treated somewhat differently.Instead of ending at the first blank line, these blocksend at the first line containing a corresponding end tag.@@ -2769,6 +2766,26 @@ document.getElementById("demo").innerHTML = "Hello JavaScript!";````````````````````````````````+A textarea tag (type 1):++```````````````````````````````` example+<textarea>++*foo*++_bar_++</textarea>+.+<textarea>++*foo*++_bar_++</textarea>+````````````````````````````````+A style tag (type 1):```````````````````````````````` example@@ -2947,7 +2964,8 @@ function matchwo(a,b)````````````````````````````````-The opening tag can be indented 1-3 spaces, but not 4:+The opening tag can be preceded by up to three spaces of indentation, but not+four:```````````````````````````````` example<!-- foo -->@@ -3023,7 +3041,7 @@ specification, which says:> The only restrictions are that block-level HTML elements —> e.g. `<div>`, `<table>`, `<pre>`, `<p>`, etc. — must be separated from> surrounding content by blank lines, and the start and end tags of the-> block should not be indented with tabs or spaces.+> block should not be indented with spaces or tabs.In some ways Gruber's rule is more restrictive than the one givenhere:@@ -3141,14 +3159,15 @@ deleted. The exception is inside `<pre>` tags, but as described## Link reference definitionsA [link reference definition](@)-consists of a [link label], indented up to three spaces, followed-by a colon (`:`), optional [whitespace] (including up to one+consists of a [link label], optionally preceded by up to three spaces of+indentation, followed+by a colon (`:`), optional spaces or tabs (including up to one[line ending]), a [link destination],-optional [whitespace] (including up to one+optional spaces or tabs (including up to one[line ending]), and an optional [linktitle], which if it is present must be separated-from the [link destination] by [whitespace].-No further [non-whitespace characters] may occur on the line.+from the [link destination] by spaces or tabs.+No further character may occur.A [link reference definition]does not correspond to a structural element of a document. Instead, it@@ -3266,7 +3285,7 @@ The link destination may not be omitted:````````````````````````````````The title must be separated from the link destination by-whitespace:+spaces or tabs:```````````````````````````````` example[foo]: <bar>(baz)@@ -3335,8 +3354,11 @@ case-insensitive (see [matches]).````````````````````````````````-Here is a link reference definition with no corresponding link.-It contributes nothing to the document.+Whether something is a [link reference definition] is+independent of whether the link reference it defines is+used in the document. Thus, for example, the following+document contains just a link reference definition, and+no visible content:```````````````````````````````` example[foo]: /url@@ -3357,7 +3379,7 @@ barThis is not a link reference definition, because there are-[non-whitespace characters] after the title:+characters other than spaces or tabs after the title:```````````````````````````````` example[foo]: /url "title" ok@@ -3489,18 +3511,6 @@ are defined:````````````````````````````````-Whether something is a [link reference definition] is-independent of whether the link reference it defines is-used in the document. Thus, for example, the following-document contains just a link reference definition, and-no visible content:--```````````````````````````````` example-[foo]: /url-.-````````````````````````````````--## ParagraphsA sequence of non-blank lines that cannot be interpreted as other@@ -3508,7 +3518,7 @@ kinds of blocks forms a [paragraph](@).The contents of the paragraph are the result of parsing theparagraph's raw content as inlines. The paragraph's raw contentis formed by concatenating the lines and removing initial and final-[whitespace].+spaces or tabs.A simple example with two paragraphs:@@ -3538,7 +3548,7 @@ ddd</p>````````````````````````````````-Multiple blank lines between paragraph have no effect:+Multiple blank lines between paragraphs have no effect:```````````````````````````````` exampleaaa@@ -3551,7 +3561,7 @@ bbb````````````````````````````````-Leading spaces are skipped:+Leading spaces or tabs are skipped:```````````````````````````````` exampleaaa@@ -3576,8 +3586,8 @@ ccc</p>````````````````````````````````-However, the first line may be indented at most three spaces,-or an indented code block will be triggered:+However, the first line may be preceded by up to three spaces of indentation.+Four spaces of indentation is too many:```````````````````````````````` exampleaaa@@ -3598,7 +3608,7 @@ bbb````````````````````````````````-Final spaces are stripped before inline parsing, so a paragraph+Final spaces or tabs are stripped before inline parsing, so a paragraphthat ends with two or more spaces will not end with a [hard linebreak]:@@ -3657,9 +3667,11 @@ these constructions. (A recipe is provided below in the section entitled## Block quotes-A [block quote marker](@)-consists of 0-3 spaces of initial indent, plus (a) the character `>` together-with a following space, or (b) a single character `>` not followed by a space.+A [block quote marker](@),+optionally preceded by up to three spaces of indentation,+consists of (a) the character `>` together with a following space of+indentation, or (b) a single character `>` not followed by a space of+indentation.The following rules define [block quotes]:@@ -3671,8 +3683,8 @@ The following rules define [block quotes]:2. **Laziness.** If a string of lines *Ls* constitute a [blockquote](#block-quotes) with contents *Bs*, then the result of deletingthe initial [block quote marker] from one or- more lines in which the next [non-whitespace character] after the [block- quote marker] is [paragraph continuation+ more lines in which the next character other than a space or tab after the+ [block quote marker] is [paragraph continuationtext] is a block quote with *Bs* as its content.[Paragraph continuation text](@) is textthat will be parsed as part of the content of a paragraph, but does@@ -3698,7 +3710,7 @@ baz</p>````````````````````````````````-The spaces after the `>` characters can be omitted:+The space or tab after the `>` characters can be omitted:```````````````````````````````` example># Foo@@ -3713,7 +3725,7 @@ baz</p>````````````````````````````````-The `>` characters can be indented 1-3 spaces:+The `>` characters can be preceded by up to three spaces of indentation:```````````````````````````````` example> # Foo@@ -3728,7 +3740,7 @@ baz</p>````````````````````````````````-Four spaces gives us a code block:+Four spaces of indentation is too many:```````````````````````````````` example> # Foo@@ -4063,8 +4075,8 @@ baz</p>When including an indented code block in a block quote,remember that the [block quote marker] includes-both the `>` and a following space. So *five spaces* are needed after-the `>`:+both the `>` and a following space of indentation. So *five spaces* are needed+after the `>`:```````````````````````````````` example> code@@ -4099,10 +4111,10 @@ in some browsers.)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-whitespace character], and *M* is a- list marker of width *W* followed by 1 ≤ *N* ≤ 4 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+ blocks *Bs* starting with a character other than a space or tab, and *M* is+ a list marker of width *W* followed by 1 ≤ *N* ≤ 4 spaces of indentation,+ 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 alist item with *Bs* as its contents. The type of the list item(bullet or ordered) is determined by the type of its list marker.If the list item is ordered, then it is also assigned a start@@ -4167,8 +4179,8 @@ with two lines.</p>The most important thing to notice is that the position ofthe text after the list marker determines how much indentationis needed in subsequent blocks in the list item. If the list-marker takes up two spaces, and there are three spaces between-the list marker and the next [non-whitespace character], then blocks+marker takes up two spaces of indentation, and there are three spaces between+the list marker and the next character other than a space or tab, then blocksmust be indented five spaces in order to fall under the listitem.@@ -4229,10 +4241,10 @@ put under the list item:It is tempting to think of this in terms of columns: the continuation-blocks must be indented at least to the column of the first-[non-whitespace character] after the list marker. However, that is not quite right.-The spaces after the list marker determine how much relative indentation-is needed. Which column this indentation reaches will depend on+blocks must be indented at least to the column of the first character other than+a space or tab after the list marker. However, that is not quite right.+The spaces of indentation after the list marker determine how much relative+indentation is needed. Which column this indentation reaches will depend onhow the list item is embedded in other constructions, as shown bythis example:@@ -4279,7 +4291,7 @@ far enough past the blockquote marker:````````````````````````````````-Note that at least one space is needed between the list marker and+Note that at least one space or tab is needed between the list marker andany following content, so these are not list items:```````````````````````````````` example@@ -4411,16 +4423,16 @@ A start number may not be negative:2. **Item starting with indented code.** If a sequence of lines *Ls*constitute a sequence of blocks *Bs* starting with an indented codeblock, 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.+ one space of indentation, 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.If a line is empty, then it need not be indented. The type of thelist item (bullet or ordered) is determined by the type of its listmarker. If the list item is ordered, then it is also assigned astart number, based on the ordered list marker.-An indented code block will have to be indented four spaces beyond-the edge of the region where text will be included in the list item.+An indented code block will have to be preceded by four spaces of indentation+beyond the edge of the region where text will be included in the list item.In the following case that is 6 spaces:```````````````````````````````` example@@ -4456,8 +4468,8 @@ And in this case it is 11 spaces:If the *first* block in the list item is an indented code block,-then by rule #2, the contents must be indented *one* space after the-list marker:+then by rule #2, the contents must be preceded by *one* space of indentation+after the list marker:```````````````````````````````` exampleindented code@@ -4493,7 +4505,7 @@ paragraph````````````````````````````````-Note that an additional space indent is interpreted as space+Note that an additional space of indentation is interpreted as spaceinside the code block:```````````````````````````````` example@@ -4517,10 +4529,10 @@ inside the code block:Note that rules #1 and #2 only apply to two cases: (a) casesin which the lines to be included in a list item begin with a-[non-whitespace character], and (b) cases in which+character other than a space or tab, and (b) cases in whichthey begin with an indented codeblock. In a case like the following, where the first block begins with-a three-space indent, the rules do not allow us to form a list item by+three spaces of indentation, the rules do not allow us to form a list item byindenting the whole thing and prepending a list marker:```````````````````````````````` example@@ -4545,8 +4557,8 @@ bar````````````````````````````````-This is not a significant restriction, because when a block begins-with 1-3 spaces indent, the indentation can always be removed without+This is not a significant restriction, because when a block is preceded by up to+three spaces of indentation, the indentation can always be removed withouta change in interpretation, allowing rule #1 to be applied. So, inthe above case:@@ -4566,11 +4578,10 @@ 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 of width *W*,+ sequence of blocks *Bs*, 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.+ preceding subsequent lines of *Ls* by *W + 1* spaces of indentation, is a+ list item with *Bs* as its contents.If a line is empty, then it need not be indented. The type of thelist item (bullet or ordered) is determined by the type of its listmarker. If the list item is ordered, then it is also assigned a@@ -4645,7 +4656,7 @@ Here is an empty bullet list item:````````````````````````````````-It does not matter whether there are spaces following the [list marker]:+It does not matter whether there are spaces or tabs following the [list marker]:```````````````````````````````` example- foo@@ -4702,9 +4713,9 @@ foo4. **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 *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+ according to rule #1, #2, or #3, then the result of preceding each line+ of *Ls* by up to three spaces of indentation (the same for each line) also+ constitutes a list item with the same contents and attributes. If a line isempty, then it need not be indented.Indented one space:@@ -4803,7 +4814,7 @@ Four spaces indent gives a code block:5. **Laziness.** If a string of lines *Ls* constitute a [listitem](#list-items) with contents *Bs*, then the result of deletingsome or all of the indentation from one or more lines in which the- next [non-whitespace character] after the indentation is+ next character other than a space or tab after the indentation is[paragraph continuation text] is alist item with the same contents and attributes. The unindentedlines are called@@ -4888,7 +4899,7 @@ continued here.</p>The rules for sublists follow from the general rules[above][List items]. A sublist must be indented the same number-of spaces a paragraph would need to be in order to be included+of spaces of indentation a paragraph would need to be in order to be includedin the list item.So, in this case we need two spaces indent:@@ -5121,8 +5132,8 @@ The choice of four spaces is arbitrary. It can be learned, but it isnot likely to be guessed, and it trips up beginners regularly.Would it help to adopt a two-space rule? The problem is that such-a rule, together with the rule allowing 1--3 spaces indentation of the-initial list marker, allows text that is indented *less than* the+a rule, together with the rule allowing up to three spaces of indentation for+the initial list marker, allows text that is indented *less than* theoriginal list marker to be included in the list item. For example,`Markdown.pl` parses@@ -5338,11 +5349,11 @@ by itself should be a paragraph followed by a nested sublist.Since it is well established Markdown practice to allow lists tointerrupt paragraphs inside list items, the [principle ofuniformity] requires us to allow this outside list items as-well. ([reStructuredText](http://docutils.sourceforge.net/rst.html)+well. ([reStructuredText](https://docutils.sourceforge.net/rst.html)takes a different approach, requiring blank lines before listseven inside other list items.)-In order to solve of unwanted lists in paragraphs with+In order to solve the problem of unwanted lists in paragraphs withhard-wrapped numerals, we allow only lists starting with `1` tointerrupt paragraphs. Thus,@@ -5514,8 +5525,8 @@ item:</ol>````````````````````````````````-Note, however, that list items may not be indented more than-three spaces. Here `- e` is treated as a paragraph continuation+Note, however, that list items may not be preceded by more than+three spaces of indentation. Here `- e` is treated as a paragraph continuationline, because it is indented more than three spaces:```````````````````````````````` example@@ -5601,7 +5612,7 @@ So is this, with a empty second item:````````````````````````````````-These are loose lists, even though there is no space between the items,+These are loose lists, even though there are no blank lines between the items,because one of the items directly contains two block-level elementswith a blank line between them:@@ -6043,18 +6054,18 @@ But this is an HTML tag:And this is code:```````````````````````````````` example-`<http://foo.bar.`baz>`+`<https://foo.bar.`baz>`.-<p><code><http://foo.bar.</code>baz>`</p>+<p><code><https://foo.bar.</code>baz>`</p>````````````````````````````````But this is an autolink:```````````````````````````````` example-<http://foo.bar.`baz>`+<https://foo.bar.`baz>`.-<p><a href="http://foo.bar.%60baz">http://foo.bar.`baz</a>`</p>+<p><a href="https://foo.bar.%60baz">https://foo.bar.`baz</a>`</p>````````````````````````````````@@ -6087,7 +6098,7 @@ closing backtick strings to be equal in length:## Emphasis and strong emphasisJohn Gruber's original [Markdown syntax-description](http://daringfireball.net/projects/markdown/syntax#em) says:+description](https://daringfireball.net/projects/markdown/syntax#em) says:> Markdown treats asterisks (`*`) and underscores (`_`) as indicators of> emphasis. Text wrapped with one `*` or `_` will be wrapped with an HTML@@ -6138,17 +6149,17 @@ a non-backslash-escaped `_` character.A [left-flanking delimiter run](@) isa [delimiter run] that is (1) not followed by [Unicode whitespace],-and either (2a) not followed by a [punctuation character], or-(2b) followed by a [punctuation character] and-preceded by [Unicode whitespace] or a [punctuation character].+and either (2a) not followed by a [Unicode punctuation character], or+(2b) followed by a [Unicode punctuation character] and+preceded by [Unicode whitespace] or a [Unicode punctuation character].For purposes of this definition, the beginning and the end ofthe line count as Unicode whitespace.A [right-flanking delimiter run](@) isa [delimiter run] that is (1) not preceded by [Unicode whitespace],-and either (2a) not preceded by a [punctuation character], or-(2b) preceded by a [punctuation character] and-followed by [Unicode whitespace] or a [punctuation character].+and either (2a) not preceded by a [Unicode punctuation character], or+(2b) preceded by a [Unicode punctuation character] and+followed by [Unicode whitespace] or a [Unicode punctuation character].For purposes of this definition, the beginning and the end ofthe line count as Unicode whitespace.@@ -6189,7 +6200,7 @@ Here are some examples of delimiter runs.(The idea of distinguishing left-flanking and right-flankingdelimiter runs based on the character before and the characterafter comes from Roopesh Chander's-[vfmd](http://www.vfmd.org/vfmd-spec/specification/#procedure-for-identifying-emphasis-tags).+[vfmd](https://web.archive.org/web/20220608143320/http://www.vfmd.org/vfmd-spec/specification/#procedure-for-identifying-emphasis-tags).vfmd uses the terminology "emphasis indicator string" instead of "delimiterrun," and its rules for distinguishing left- and right-flanking runsare a bit more complex than the ones given here.)@@ -6203,7 +6214,7 @@ The following rules define emphasis and strong emphasis: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 delimiter run]- preceded by punctuation.+ preceded by a [Unicode punctuation character].3. A single `*` character [can close emphasis](@)iff it is part of a [right-flanking delimiter run].@@ -6212,7 +6223,7 @@ The following rules define emphasis and strong emphasis: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 delimiter run]- followed by punctuation.+ followed by a [Unicode punctuation character].5. A double `**` [can open strong emphasis](@)iff it is part of a [left-flanking delimiter run].@@ -6221,7 +6232,7 @@ The following rules define emphasis and strong emphasis: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 delimiter run]- preceded by punctuation.+ preceded by a [Unicode punctuation character].7. A double `**` [can close strong emphasis](@)iff it is part of a [right-flanking delimiter run].@@ -6230,7 +6241,7 @@ The following rules define emphasis and strong emphasis: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 delimiter run]- followed by punctuation.+ followed by a [Unicode punctuation character].9. Emphasis begins with a delimiter that [can open emphasis] and endswith a delimiter that [can close emphasis], and that uses the same@@ -6331,6 +6342,21 @@ Unicode nonbreaking spaces count as whitespace, too:````````````````````````````````+Unicode symbols count as punctuation, too:++```````````````````````````````` example+*$*alpha.++*£*bravo.++*€*charlie.+.+<p>*$*alpha.</p>+<p>*£*bravo.</p>+<p>*€*charlie.</p>+````````````````````````````````++Intraword emphasis with `*` is permitted:```````````````````````````````` example@@ -6442,7 +6468,7 @@ whitespace:````````````````````````````````-A newline also counts as whitespace:+A line ending also counts as whitespace:```````````````````````````````` example*foo bar@@ -6607,7 +6633,7 @@ __ foo bar__````````````````````````````````-A newline counts as whitespace:+A line ending counts as whitespace:```````````````````````````````` example__foo bar__@@ -6886,7 +6912,7 @@ emphasis sections in this example:The same condition ensures that the followingcases are all strong emphasis nested inside-emphasis, even when the interior spaces are+emphasis, even when the interior whitespace isomitted:@@ -7416,16 +7442,16 @@ _a `_`_```````````````````````````````` example-**a<http://foo.bar/?q=**>+**a<https://foo.bar/?q=**>.-<p>**a<a href="http://foo.bar/?q=**">http://foo.bar/?q=**</a></p>+<p>**a<a href="https://foo.bar/?q=**">https://foo.bar/?q=**</a></p>```````````````````````````````````````````````````````````````` example-__a<http://foo.bar/?q=__>+__a<https://foo.bar/?q=__>.-<p>__a<a href="http://foo.bar/?q=__">http://foo.bar/?q=__</a></p>+<p>__a<a href="https://foo.bar/?q=__">https://foo.bar/?q=__</a></p>````````````````````````````````@@ -7463,12 +7489,12 @@ following rules apply:A [link destination](@) consists of either- a sequence of zero or more characters between an opening `<` and a- closing `>` that contains no line breaks or unescaped+ closing `>` that contains no line endings or unescaped`<` or `>` characters, or- a nonempty sequence of characters that does not start with `<`,does not include [ASCII control characters][ASCII control character]- or [whitespace][], and includes parentheses only if (a) they are+ or [space] character, and includes parentheses only if (a) they arebackslash-escaped or (b) they are part of a balanced pair ofunescaped parentheses.(Implementations may impose limits on parentheses nesting to@@ -7493,10 +7519,14 @@ Although [link titles] may span multiple lines, they may not containa [blank line].An [inline link](@) consists of a [link text] followed immediately-by a left parenthesis `(`, optional [whitespace], an optional-[link destination], an optional [link title] separated from the link-destination by [whitespace], optional [whitespace], and a right-parenthesis `)`. The link's text consists of the inlines contained+by a left parenthesis `(`, an optional [link destination], an optional+[link title], and a right parenthesis `)`.+These four components may be separated by spaces, tabs, and up to one line+ending.+If both [link destination] and [link title] are present, they *must* be+separated by spaces, tabs, and up to one line ending.++The link's text consists of the inlines containedin the [link text] (excluding the enclosing square brackets).The link's URI consists of the link destination, excluding enclosing`<...>` if present, with backslash-escapes in effect as described@@ -7513,7 +7543,8 @@ Here is a simple inline link:````````````````````````````````-The title may be omitted:+The title, the link text and even+the destination may be omitted:```````````````````````````````` example[link](/uri)@@ -7521,8 +7552,12 @@ The title may be omitted:<p><a href="/uri">link</a></p>````````````````````````````````+```````````````````````````````` example+[](./target.md)+.+<p><a href="./target.md"></a></p>+````````````````````````````````-Both the title and the destination may be omitted:```````````````````````````````` example[link]()@@ -7537,6 +7572,13 @@ Both the title and the destination may be omitted:<p><a href="">link</a></p>````````````````````````````````++```````````````````````````````` example+[]()+.+<p><a href=""></a></p>+````````````````````````````````+The destination can only contain spaces if it isenclosed in pointy brackets:@@ -7552,7 +7594,7 @@ enclosed in pointy brackets:<p><a href="/my%20uri">link</a></p>````````````````````````````````-The destination cannot contain line breaks,+The destination cannot contain line endings,even if enclosed in pointy brackets:```````````````````````````````` example@@ -7621,6 +7663,13 @@ balanced:However, if you have unbalanced parentheses, you need to escape or use the`<...>` form:+```````````````````````````````` example+[link](foo(and(bar))+.+<p>[link](foo(and(bar))</p>+````````````````````````````````++```````````````````````````````` example[link](foo\(and\(bar\)).@@ -7650,13 +7699,13 @@ A link can contain fragment identifiers and queries:```````````````````````````````` example[link](#fragment)-[link](http://example.com#fragment)+[link](https://example.com#fragment)-[link](http://example.com?foo=3#frag)+[link](https://example.com?foo=3#frag).<p><a href="#fragment">link</a></p>-<p><a href="http://example.com#fragment">link</a></p>-<p><a href="http://example.com?foo=3#frag">link</a></p>+<p><a href="https://example.com#fragment">link</a></p>+<p><a href="https://example.com?foo=3#frag">link</a></p>````````````````````````````````@@ -7720,7 +7769,8 @@ may be used in titles:````````````````````````````````-Titles must be separated from the link using a [whitespace].+Titles must be separated from the link using spaces, tabs, and up to one line+ending.Other [Unicode whitespace] like non-breaking space doesn't work.```````````````````````````````` example@@ -7763,7 +7813,8 @@ titles with no closing quotation mark, though 1.0.2b8 does not.It seems preferable to adopt a simple, rational rule that worksthe same way in inline links and link reference definitions.)-[Whitespace] is allowed around the destination and title:+Spaces, tabs, and up to one line ending is allowed around the destination and+title:```````````````````````````````` example[link]( /uri@@ -7898,9 +7949,9 @@ and autolinks over link grouping:```````````````````````````````` example-[foo<http://example.com/?search=](uri)>+[foo<https://example.com/?search=](uri)>.-<p>[foo<a href="http://example.com/?search=%5D(uri)">http://example.com/?search=](uri)</a></p>+<p>[foo<a href="https://example.com/?search=%5D(uri)">https://example.com/?search=](uri)</a></p>````````````````````````````````@@ -7914,7 +7965,8 @@ that [matches] a [link reference definition] elsewhere in the document.A [link label](@) begins with a left bracket (`[`) and endswith the first right bracket (`]`) that is not backslash-escaped.-Between these brackets there must be at least one [non-whitespace character].+Between these brackets there must be at least one character that is not a space,+tab, or line ending.Unescaped square bracket characters are not allowed inside theopening and closing square brackets of [link labels]. A linklabel can have at most 999 characters inside the square@@ -7924,8 +7976,8 @@ One label [matches](@)another just in case their normalized forms are equal. To normalize alabel, strip off the opening and closing brackets,perform the *Unicode case fold*, strip leading and trailing-[whitespace] and collapse consecutive internal-[whitespace] to a single space. If there are multiple+spaces, tabs, and line endings, and collapse consecutive internal+spaces, tabs, and line endings to a single space. If there are multiplematching reference link definitions, the one that comes first in thedocument is used. (It is desirable in such cases to emit a warning.)@@ -8053,11 +8105,11 @@ and autolinks over link grouping:```````````````````````````````` example-[foo<http://example.com/?search=][ref]>+[foo<https://example.com/?search=][ref]>[ref]: /uri.-<p>[foo<a href="http://example.com/?search=%5D%5Bref%5D">http://example.com/?search=][ref]</a></p>+<p>[foo<a href="https://example.com/?search=%5D%5Bref%5D">https://example.com/?search=][ref]</a></p>````````````````````````````````@@ -8083,7 +8135,7 @@ Unicode case fold is used:````````````````````````````````-Consecutive internal [whitespace] is treated as one space for+Consecutive internal spaces, tabs, and line endings are treated as one space forpurposes of determining matching:```````````````````````````````` example@@ -8096,7 +8148,7 @@ purposes of determining matching:````````````````````````````````-No [whitespace] is allowed between the [link text] and the+No spaces, tabs, or line endings are allowed between the [link text] and the[link label]:```````````````````````````````` example@@ -8226,7 +8278,8 @@ Note that in this example `]` is not backslash-escaped:````````````````````````````````-A [link label] must contain at least one [non-whitespace character]:+A [link label] must contain at least one character that is not a space, tab, or+line ending:```````````````````````````````` example[]@@ -8256,7 +8309,7 @@ A [collapsed reference link](@)consists of a [link label] that [matches] a[link reference definition] elsewhere in thedocument, followed by the string `[]`.-The contents of the first link label are parsed as inlines,+The contents of the link label are parsed as inlines,which are used as the link's text. The link's URI and title areprovided by the matching reference link definition. Thus,`[foo][]` is equivalent to `[foo][foo]`.@@ -8291,7 +8344,7 @@ The link labels are case-insensitive:-As with full reference links, [whitespace] is not+As with full reference links, spaces, tabs, or line endings are notallowed between the two sets of brackets:```````````````````````````````` example@@ -8309,7 +8362,7 @@ A [shortcut reference link](@)consists of a [link label] that [matches] a[link reference definition] elsewhere in thedocument and is not followed by `[]` or a link label.-The contents of the first link label are parsed as inlines,+The contents of the link label are parsed as inlines,which are used as the link's text. The link's URI and titleare provided by the matching link reference definition.Thus, `[foo]` is equivalent to `[foo][]`.@@ -8396,7 +8449,7 @@ following closing bracket:````````````````````````````````-Full and compact references take precedence over shortcut+Full and collapsed references take precedence over shortcutreferences:```````````````````````````````` example@@ -8564,7 +8617,7 @@ My ```````````````````````````````` example.-<p><img src="/url" alt="" role="presentation" /></p>+<p><img src="/url" alt="" /></p>````````````````````````````````@@ -8619,7 +8672,7 @@ The labels are case-insensitive:````````````````````````````````-As with reference links, [whitespace] is not allowed+As with reference links, spaces, tabs, and line endings, are not allowedbetween the two sets of brackets:```````````````````````````````` example@@ -8712,8 +8765,8 @@ a link to the URI, with the URI as the link's label.An [absolute URI](@),for these purposes, consists of a [scheme] followed by a colon (`:`)-followed by zero or more characters other [ASCII control-characters][ASCII control character] or [whitespace][] , `<`, and `>`.+followed by zero or more characters other than [ASCII control+characters][ASCII control character], [space], `<`, and `>`.If the URI includes these characters, they must be percent-encoded(e.g. `%20` for a space).@@ -8732,9 +8785,9 @@ Here are some valid autolinks:```````````````````````````````` example-<http://foo.bar.baz/test?q=hello&id=22&boolean>+<https://foo.bar.baz/test?q=hello&id=22&boolean>.-<p><a href="http://foo.bar.baz/test?q=hello&id=22&boolean">http://foo.bar.baz/test?q=hello&id=22&boolean</a></p>+<p><a href="https://foo.bar.baz/test?q=hello&id=22&boolean">https://foo.bar.baz/test?q=hello&id=22&boolean</a></p>````````````````````````````````@@ -8774,9 +8827,9 @@ with their syntax:```````````````````````````````` example-<http://../>+<https://../>.-<p><a href="http://../">http://../</a></p>+<p><a href="https://../">https://../</a></p>````````````````````````````````@@ -8790,18 +8843,18 @@ with their syntax:Spaces are not allowed in autolinks:```````````````````````````````` example-<http://foo.bar/baz bim>+<https://foo.bar/baz bim>.-<p><http://foo.bar/baz bim></p>+<p><https://foo.bar/baz bim></p>````````````````````````````````Backslash-escapes do not work inside autolinks:```````````````````````````````` example-<http://example.com/\[\>+<https://example.com/\[\>.-<p><a href="http://example.com/%5C%5B%5C">http://example.com/\[\</a></p>+<p><a href="https://example.com/%5C%5B%5C">https://example.com/\[\</a></p>````````````````````````````````@@ -8853,9 +8906,9 @@ These are not autolinks:```````````````````````````````` example-< http://foo.bar >+< https://foo.bar >.-<p>< http://foo.bar ></p>+<p>< https://foo.bar ></p>````````````````````````````````@@ -8874,9 +8927,9 @@ These are not autolinks:```````````````````````````````` example-http://example.com+https://example.com.-<p>http://example.com</p>+<p>https://example.com</p>````````````````````````````````@@ -8900,7 +8953,7 @@ A [tag name](@) consists of an ASCII letterfollowed by zero or more ASCII letters, digits, orhyphens (`-`).-An [attribute](@) consists of [whitespace],+An [attribute](@) consists of spaces, tabs, and up to one line ending,an [attribute name], and an optional[attribute value specification].@@ -8910,9 +8963,9 @@ letters, digits, `_`, `.`, `:`, or `-`. (Note: This is the XMLspecification restricted to ASCII. HTML5 is laxer.)An [attribute value specification](@)-consists of optional [whitespace],-a `=` character, optional [whitespace], and an [attribute-value].+consists of optional spaces, tabs, and up to one line ending,+a `=` character, optional spaces, tabs, and up to one line ending,+and an [attribute value].An [attribute value](@)consists of an [unquoted attribute value],@@ -8920,7 +8973,7 @@ a [single-quoted attribute value], or a [double-quoted attribute value].An [unquoted attribute value](@)is a nonempty string of characters not-including [whitespace], `"`, `'`, `=`, `<`, `>`, or `` ` ``.+including spaces, tabs, line endings, `"`, `'`, `=`, `<`, `>`, or `` ` ``.A [single-quoted attribute value](@)consists of `'`, zero or more@@ -8931,26 +8984,24 @@ consists of `"`, zero or morecharacters not including `"`, and a final `"`.An [open tag](@) consists of a `<` character, a [tag name],-zero or more [attributes], optional [whitespace], an optional `/`-character, and a `>` character.+zero or more [attributes], optional spaces, tabs, and up to one line ending,+an optional `/` character, and a `>` character.A [closing tag](@) consists of the string `</`, a-[tag name], optional [whitespace], and the character `>`.+[tag name], optional spaces, tabs, and up to one line ending, and the character+`>`.-An [HTML comment](@) consists of `<!--` + *text* + `-->`,-where *text* does not start with `>` or `->`, does not end with `-`,-and does not contain `--`. (See the-[HTML5 spec](http://www.w3.org/TR/html5/syntax.html#comments).)+An [HTML comment](@) consists of `<!-->`, `<!--->`, or `<!--`, a string of+characters not including the string `-->`, and `-->` (see the+[HTML spec](https://html.spec.whatwg.org/multipage/parsing.html#markup-declaration-open-state)).A [processing instruction](@)consists of the string `<?`, a stringof characters not including the string `?>`, and the string`?>`.-A [declaration](@) consists of the-string `<!`, a name consisting of one or more uppercase ASCII letters,-[whitespace], a string of characters not including the-character `>`, and the character `>`.+A [declaration](@) consists of the string `<!`, an ASCII letter, zero or more+characters not including the character `>`, and the character `>`.A [CDATA section](@) consists ofthe string `<![CDATA[`, a string of characters not including the string@@ -8978,7 +9029,7 @@ Empty elements:````````````````````````````````-[Whitespace] is allowed:+Whitespace is allowed:```````````````````````````````` example<a /><b2@@ -9036,7 +9087,7 @@ Illegal attribute values:````````````````````````````````-Illegal [whitespace]:+Illegal whitespace:```````````````````````````````` example< a><@@ -9051,7 +9102,7 @@ bim!bop /></p>````````````````````````````````-Missing [whitespace]:+Missing whitespace:```````````````````````````````` example<a href='bar'title=title>@@ -9081,30 +9132,20 @@ Illegal attributes in closing tag:Comments:```````````````````````````````` example-foo <!-- this is a-comment - with hyphen -->+foo <!-- this is a --+comment - with hyphens -->.-<p>foo <!-- this is a-comment - with hyphen --></p>+<p>foo <!-- this is a --+comment - with hyphens --></p>````````````````````````````````--```````````````````````````````` example-foo <!-- not a comment -- two hyphens -->-.-<p>foo <!-- not a comment -- two hyphens --></p>-````````````````````````````````---Not comments:-```````````````````````````````` examplefoo <!--> foo -->-foo <!-- foo--->+foo <!---> foo -->.-<p>foo <!--> foo --></p>-<p>foo <!-- foo---></p>+<p>foo <!--> foo --></p>+<p>foo <!---> foo --></p>````````````````````````````````@@ -9163,7 +9204,7 @@ foo <a href="\*">## Hard line breaks-A line break (not in a code span or HTML tag) that is preceded+A line ending (not in a code span or HTML tag) that is precededby two or more spaces and does not occur at the end of a blockis parsed as a [hard line break](@) (renderedin HTML as a `<br />` tag):@@ -9178,7 +9219,7 @@ baz</p>For a more visible alternative, a backslash before the-[line ending] may be used instead of two spaces:+[line ending] may be used instead of two or more spaces:```````````````````````````````` examplefoo\@@ -9220,7 +9261,7 @@ bar</p>````````````````````````````````-Line breaks can occur inside emphasis, links, and other constructs+Hard line breaks can occur inside emphasis, links, and other constructsthat allow inline content:```````````````````````````````` example@@ -9241,13 +9282,13 @@ bar</em></p>````````````````````````````````-Line breaks do not occur inside code spans+Hard line breaks do not occur inside code spans```````````````````````````````` example-`code+`codespan`.-<p><code>code span</code></p>+<p><code>code span</code></p>````````````````````````````````@@ -9313,9 +9354,9 @@ foo## Soft line breaks-A regular line break (not in a code span or HTML tag) that is not+A regular line ending (not in a code span or HTML tag) that is notpreceded by two or more spaces or a backslash is parsed as a-[softbreak](@). (A softbreak may be rendered in HTML either as a+[softbreak](@). (A soft line break may be rendered in HTML either as a[line ending] or as a space. The result will be the same inbrowsers. In the examples here, a [line ending] will be used.)@@ -9341,7 +9382,7 @@ baz</p>A conforming parser may render a soft line break in HTML either as a-line break or as a space.+line ending or as a space.A renderer may also provide an option to render soft line breaksas hard line breaks.@@ -9633,7 +9674,7 @@ through the stack for an opening `[` or `![` delimiter.delimiter from the stack, and return a literal text node `]`.- If we find one and it's active, then we parse ahead to see if- we have an inline link/image, reference link/image, compact reference+ we have an inline link/image, reference link/image, collapsed referencelink/image, or shortcut reference link/image.+ If we don't, then we remove the opening delimiter from the@@ -9665,8 +9706,9 @@ just above `stack_bottom` (or the first element if `stack_bottom`is NULL).We keep track of the `openers_bottom` for each delimiter-type (`*`, `_`) and each length of the closing delimiter run-(modulo 3). Initialize this to `stack_bottom`.+type (`*`, `_`), indexed to the length of the closing delimiter run+(modulo 3) and to whether the closing delimiter can also be an+opener. Initialize this to `stack_bottom`.Then we repeat the following until we run out of potentialclosers:@@ -9712,4 +9754,3 @@ closers:After we're done, we remove all delimiters above `stack_bottom` from thedelimiter stack.-diff --git a/spec/integrity/common_mark_spec.rb b/spec/integrity/common_mark_spec.rbindex cb23147358a..00665e817c8 100644--- a/spec/integrity/common_mark_spec.rb+++ b/spec/integrity/common_mark_spec.rb@@ -32,6 +32,8 @@ RSpec.describe "CommonMark" docooked.strip!cooked.gsub!(" class=\"lang-auto\"", "")cooked.gsub!(%r{<span class="hashtag-raw">(.*)</span>}, "\\1")+ cooked.gsub!(%r{<span class="mention">(@[^<]*)</span>}, "\\1")+ cooked.gsub!(' role="presentation"', "")cooked.gsub!(%r{<a name="(.*)" class="anchor" href="#\1*"( aria-label="[^"]*")?></a>}, "")# we support data-attributes which is not in the speccooked.gsub!(" data-code-startline=\"3\"", "")