Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates from upstream #235

Merged
merged 2 commits into from
Mar 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/commonmarker/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Commonmarker
VERSION = "1.0.0.pre8"
VERSION = "1.0.0.pre9"
end
50 changes: 18 additions & 32 deletions test/fixtures/upstream/spec.txt
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,15 @@ questions it does not answer:
not require that. This is hardly a "corner case," and divergences
between implementations on this issue often lead to surprises for
users 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,
this can lead to unexpected results in hard-wrapped text, and
also to ambiguities in parsing (note that some implementations
put 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
Expand Down Expand Up @@ -171,7 +171,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?

Expand Down Expand Up @@ -1001,10 +1001,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 in
the [setext heading underline], and a level 2 heading if `-`
Expand Down Expand Up @@ -1638,7 +1635,7 @@ has been found, the code block contains all of the lines after the
opening code fence until the end of the containing block (or
document). (An alternative spec would require backtracking in the
event 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 the
behavior described here.)

A fenced code block may interrupt a paragraph, and does not require
Expand Down Expand Up @@ -2068,7 +2065,7 @@ followed by an uppercase ASCII letter.\
`<![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`,
Expand All @@ -2077,7 +2074,7 @@ 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`,
`section`, `summary`, `table`, `tbody`, `td`,
`tfoot`, `th`, `thead`, `title`, `tr`, `track`, `ul`, followed
by [whitespace], the end of the line, the string `>`, or
the string `/>`.\
Expand Down Expand Up @@ -5279,7 +5276,7 @@ well. ([reStructuredText](http://docutils.sourceforge.net/rst.html)
takes a different approach, requiring blank lines before lists
even 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 with
hard-wrapped numerals, we allow only lists starting with `1` to
interrupt paragraphs. Thus,

Expand Down Expand Up @@ -9410,10 +9407,9 @@ character, and a `>` character.
A [closing tag](@) consists of the string `</`, a
[tag name], optional [whitespace], 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 string
Expand Down Expand Up @@ -9554,30 +9550,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 &lt;!-- not a comment -- two hyphens --&gt;</p>
````````````````````````````````


Not comments:

```````````````````````````````` example
foo <!--> foo -->

foo <!-- foo--->
foo <!---> foo -->
.
<p>foo &lt;!--&gt; foo --&gt;</p>
<p>foo &lt;!-- foo---&gt;</p>
<p>foo <!--> foo --&gt;</p>
<p>foo <!---> foo --&gt;</p>
````````````````````````````````


Expand Down
8 changes: 4 additions & 4 deletions test/test_footnotes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ def test_to_html
MARKDOWN
expected = <<~HTML
<h1>footnotes</h1>
<p>Let's render some footnotes<sup class="footnote-ref"><a href="#fn1" id="fnref1">1</a></sup></p>
<section class="footnotes">
<p>Let's render some footnotes<sup class="footnote-ref"><a href="#fn-1" id="fnref-1" data-footnote-ref>1</a></sup></p>
<section class="footnotes" data-footnotes>
<ol>
<li id="fn1">
<p>This is a footnote <a href="#fnref1" class="footnote-backref">↩</a></p>
<li id="fn-1">
<p>This is a footnote <a href="#fnref-1" class="footnote-backref" data-footnote-backref aria-label="Back to content">↩</a></p>
</li>
</ol>
</section>
Expand Down
9 changes: 3 additions & 6 deletions test/test_syntax_highlighting.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ def hello
<span style="color:#b48ead;">def </span><span style="color:#8fa1b3;">hello
</span><span style="color:#c0c5ce;"> </span><span style="color:#96b5b4;">puts </span><span style="color:#c0c5ce;">&quot;</span><span style="color:#a3be8c;">hello</span><span style="color:#c0c5ce;">&quot;
</span><span style="color:#b48ead;">end
</span>
</code></pre>
</span></code></pre>
HTML

lang = %(lang="ruby")
Expand Down Expand Up @@ -130,8 +129,7 @@ def hello
<span style="font-weight:bold;color:#a71d5d;">def </span><span style="font-weight:bold;color:#795da3;">hello
</span><span style="color:#323232;"> </span><span style="color:#62a35c;">puts </span><span style="color:#183691;">&quot;hello&quot;
</span><span style="font-weight:bold;color:#a71d5d;">end
</span>
</code></pre>
</span></code></pre>
HTML

lang = %(lang="ruby")
Expand Down Expand Up @@ -172,8 +170,7 @@ def hello
<span style="color:#99ff99;">def </span><span style="color:#a6e22e;">hello
</span><span style="color:#ccccff;"> </span><span style="color:#ffcc66;">puts </span><span style="color:#e6db74;">&quot;hello&quot;
</span><span style="color:#99ff99;">end
</span>
</code></pre>
</span></code></pre>
HTML

lang = %(lang="ruby")
Expand Down