From d6d7b398e42cbb2a686fcfbd05545e604b033e98 Mon Sep 17 00:00:00 2001 From: Alexandre Mutel Date: Sun, 18 Sep 2016 13:24:19 +0200 Subject: [PATCH] Update to latest CommonMark specs. Fix new corner cases when parsing inline links --- src/Markdig.Tests/Specs/Specs.cs | 2945 +++++++++-------- src/Markdig.Tests/Specs/Specs.tt | 2 +- .../Parsers/Inlines/LinkInlineParser.cs | 6 +- 3 files changed, 1525 insertions(+), 1428 deletions(-) diff --git a/src/Markdig.Tests/Specs/Specs.cs b/src/Markdig.Tests/Specs/Specs.cs index cff69abd..69afcb09 100644 --- a/src/Markdig.Tests/Specs/Specs.cs +++ b/src/Markdig.Tests/Specs/Specs.cs @@ -3277,7 +3277,7 @@ namespace Markdig.Tests // 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 other [container block](@), if no line is encountered that meets the + // the document or other [container block]), if no line is encountered that meets the // [end condition]. If the first line meets both the [start condition] // and the [end condition], the block will contain just that line. // @@ -3307,7 +3307,8 @@ namespace Markdig.Tests // `article`, `aside`, `base`, `basefont`, `blockquote`, `body`, // `caption`, `center`, `col`, `colgroup`, `dd`, `details`, `dialog`, // `dir`, `div`, `dl`, `dt`, `fieldset`, `figcaption`, `figure`, - // `footer`, `form`, `frame`, `frameset`, `h1`, `head`, `header`, `hr`, + // `footer`, `form`, `frame`, `frameset`, + // `h1`, `h2`, `h3`, `h4`, `h5`, `h6`, `head`, `header`, `hr`, // `html`, `iframe`, `legend`, `li`, `link`, `main`, `menu`, `menuitem`, // `meta`, `nav`, `noframes`, `ol`, `optgroup`, `option`, `p`, `param`, // `section`, `source`, `summary`, `table`, `tbody`, `td`, @@ -7666,8 +7667,7 @@ namespace Markdig.Tests // // A [list](@) is a sequence of one or more // list items [of the same type]. The list items - // may be separated by single [blank lines], but two - // blank lines end all containing lists. + // may be separated by any number of blank lines. // // Two list items are [of the same type](@) // if they begin with a [list marker] of the same type. @@ -7780,10 +7780,11 @@ namespace Markdig.Tests // `Markdown.pl` does not allow this, through fear of triggering a list // via a numeral in a hard-wrapped line: // - // ```````````````````````````````` markdown + // ``` markdown // The number of windows in my house is // 14. The number of doors is 6. - // ```````````````````````````````` + // ``` + // // Oddly, though, `Markdown.pl` *does* allow a blockquote to // interrupt a paragraph, even though the same considerations might // apply. @@ -7792,10 +7793,12 @@ namespace Markdig.Tests // two reasons. First, it is natural and not uncommon for people // to start lists without blank lines: // + // ``` markdown // I need to buy // - new shoes // - a coat // - a plane ticket + // ``` // // Second, we are attracted to a // @@ -7807,20 +7810,24 @@ namespace Markdig.Tests // (Indeed, the spec for [list items] and [block quotes] presupposes // this principle.) This principle implies that if // + // ``` markdown // * I need to buy // - new shoes // - a coat // - a plane ticket + // ``` // // is a list item containing a paragraph followed by a nested sublist, // as all Markdown implementations agree it is (though the paragraph // may be rendered without `

` tags, since the list is "tight"), // then // + // ``` markdown // I need to buy // - new shoes // - a coat // - a plane ticket + // ``` // // by itself should be a paragraph followed by a nested sublist. // @@ -9231,6 +9238,27 @@ namespace Markdig.Tests Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 316, "Inlines Code spans"); TestParser.TestSpec("`foo bar\n baz`", "

foo bar baz

", ""); } + } + // Not all [Unicode whitespace] (for instance, non-breaking space) is + // collapsed, however: + [TestFixture] + public partial class TestInlinesCodespans + { + [Test] + public void Example317() + { + // Example 317 + // Section: Inlines Code spans + // + // The following CommonMark: + // `a  b` + // + // Should be rendered as: + //

a  b

+ + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 317, "Inlines Code spans"); + TestParser.TestSpec("`a  b`", "

a  b

", ""); + } } // Q: Why not just leave the spaces, since browsers will collapse them // anyway? A: Because we might be targeting a non-HTML format, and we @@ -9248,9 +9276,9 @@ namespace Markdig.Tests public partial class TestInlinesCodespans { [Test] - public void Example317() + public void Example318() { - // Example 317 + // Example 318 // Section: Inlines Code spans // // The following CommonMark: @@ -9259,7 +9287,7 @@ namespace Markdig.Tests // Should be rendered as: //

foo `` bar

- Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 317, "Inlines Code spans"); + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 318, "Inlines Code spans"); TestParser.TestSpec("`foo `` bar`", "

foo `` bar

", ""); } } @@ -9269,9 +9297,9 @@ namespace Markdig.Tests public partial class TestInlinesCodespans { [Test] - public void Example318() + public void Example319() { - // Example 318 + // Example 319 // Section: Inlines Code spans // // The following CommonMark: @@ -9280,7 +9308,7 @@ namespace Markdig.Tests // Should be rendered as: //

foo\bar`

- Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 318, "Inlines Code spans"); + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 319, "Inlines Code spans"); TestParser.TestSpec("`foo\\`bar`", "

foo\\bar`

", ""); } } @@ -9296,9 +9324,9 @@ namespace Markdig.Tests public partial class TestInlinesCodespans { [Test] - public void Example319() + public void Example320() { - // Example 319 + // Example 320 // Section: Inlines Code spans // // The following CommonMark: @@ -9307,34 +9335,13 @@ namespace Markdig.Tests // Should be rendered as: //

*foo*

- Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 319, "Inlines Code spans"); + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 320, "Inlines Code spans"); TestParser.TestSpec("*foo`*`", "

*foo*

", ""); } } // And this is not parsed as a link: [TestFixture] public partial class TestInlinesCodespans - { - [Test] - public void Example320() - { - // Example 320 - // Section: Inlines Code spans - // - // The following CommonMark: - // [not a `link](/foo`) - // - // Should be rendered as: - //

[not a link](/foo)

- - Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 320, "Inlines Code spans"); - TestParser.TestSpec("[not a `link](/foo`)", "

[not a link](/foo)

", ""); - } - } - // Code spans, HTML tags, and autolinks have the same precedence. - // Thus, this is code: - [TestFixture] - public partial class TestInlinesCodespans { [Test] public void Example321() @@ -9343,16 +9350,17 @@ namespace Markdig.Tests // Section: Inlines Code spans // // The following CommonMark: - // `` + // [not a `link](/foo`) // // Should be rendered as: - //

<a href="">`

+ //

[not a link](/foo)

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 321, "Inlines Code spans"); - TestParser.TestSpec("`
`", "

<a href="">`

", ""); + TestParser.TestSpec("[not a `link](/foo`)", "

[not a link](/foo)

", ""); } } - // But this is an HTML tag: + // Code spans, HTML tags, and autolinks have the same precedence. + // Thus, this is code: [TestFixture] public partial class TestInlinesCodespans { @@ -9363,16 +9371,16 @@ namespace Markdig.Tests // Section: Inlines Code spans // // The following CommonMark: - //
` + // `` // // Should be rendered as: - //

`

+ //

<a href="">`

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 322, "Inlines Code spans"); - TestParser.TestSpec("
`", "

`

", ""); + TestParser.TestSpec("``", "

<a href="">`

", ""); } } - // And this is code: + // But this is an HTML tag: [TestFixture] public partial class TestInlinesCodespans { @@ -9383,16 +9391,16 @@ namespace Markdig.Tests // Section: Inlines Code spans // // The following CommonMark: - // `` + //
` // // Should be rendered as: - //

<http://foo.bar.baz>`

+ //

`

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 323, "Inlines Code spans"); - TestParser.TestSpec("``", "

<http://foo.bar.baz>`

", ""); + TestParser.TestSpec("
`", "

`

", ""); } } - // But this is an autolink: + // And this is code: [TestFixture] public partial class TestInlinesCodespans { @@ -9403,17 +9411,16 @@ namespace Markdig.Tests // Section: Inlines Code spans // // The following CommonMark: - // ` + // `` // // Should be rendered as: - //

http://foo.bar.`baz`

+ //

<http://foo.bar.baz>`

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 324, "Inlines Code spans"); - TestParser.TestSpec("`", "

http://foo.bar.`baz`

", ""); + TestParser.TestSpec("``", "

<http://foo.bar.baz>`

", ""); } } - // When a backtick string is not closed by a matching backtick string, - // we just have literal backticks: + // But this is an autolink: [TestFixture] public partial class TestInlinesCodespans { @@ -9424,15 +9431,17 @@ namespace Markdig.Tests // Section: Inlines Code spans // // The following CommonMark: - // ```foo`` + // ` // // Should be rendered as: - //

```foo``

+ //

http://foo.bar.`baz`

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 325, "Inlines Code spans"); - TestParser.TestSpec("```foo``", "

```foo``

", ""); + TestParser.TestSpec("`", "

http://foo.bar.`baz`

", ""); } } + // When a backtick string is not closed by a matching backtick string, + // we just have literal backticks: [TestFixture] public partial class TestInlinesCodespans { @@ -9443,12 +9452,31 @@ namespace Markdig.Tests // Section: Inlines Code spans // // The following CommonMark: + // ```foo`` + // + // Should be rendered as: + //

```foo``

+ + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 326, "Inlines Code spans"); + TestParser.TestSpec("```foo``", "

```foo``

", ""); + } + } + [TestFixture] + public partial class TestInlinesCodespans + { + [Test] + public void Example327() + { + // Example 327 + // Section: Inlines Code spans + // + // The following CommonMark: // `foo // // Should be rendered as: //

`foo

- Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 326, "Inlines Code spans"); + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 327, "Inlines Code spans"); TestParser.TestSpec("`foo", "

`foo

", ""); } } @@ -9660,9 +9688,9 @@ namespace Markdig.Tests public partial class TestInlinesEmphasisandstrongemphasis { [Test] - public void Example327() + public void Example328() { - // Example 327 + // Example 328 // Section: Inlines Emphasis and strong emphasis // // The following CommonMark: @@ -9671,7 +9699,7 @@ namespace Markdig.Tests // Should be rendered as: //

foo bar

- Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 327, "Inlines Emphasis and strong emphasis"); + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 328, "Inlines Emphasis and strong emphasis"); TestParser.TestSpec("*foo bar*", "

foo bar

", ""); } } @@ -9679,28 +9707,6 @@ namespace Markdig.Tests // whitespace, and hence not part of a [left-flanking delimiter run]: [TestFixture] public partial class TestInlinesEmphasisandstrongemphasis - { - [Test] - public void Example328() - { - // Example 328 - // Section: Inlines Emphasis and strong emphasis - // - // The following CommonMark: - // a * foo bar* - // - // Should be rendered as: - //

a * foo bar*

- - Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 328, "Inlines Emphasis and strong emphasis"); - TestParser.TestSpec("a * foo bar*", "

a * foo bar*

", ""); - } - } - // This is not emphasis, because the opening `*` is preceded - // by an alphanumeric and followed by punctuation, and hence - // not part of a [left-flanking delimiter run]: - [TestFixture] - public partial class TestInlinesEmphasisandstrongemphasis { [Test] public void Example329() @@ -9709,16 +9715,18 @@ namespace Markdig.Tests // Section: Inlines Emphasis and strong emphasis // // The following CommonMark: - // a*"foo"* + // a * foo bar* // // Should be rendered as: - //

a*"foo"*

+ //

a * foo bar*

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 329, "Inlines Emphasis and strong emphasis"); - TestParser.TestSpec("a*\"foo\"*", "

a*"foo"*

", ""); + TestParser.TestSpec("a * foo bar*", "

a * foo bar*

", ""); } } - // Unicode nonbreaking spaces count as whitespace, too: + // This is not emphasis, because the opening `*` is preceded + // by an alphanumeric and followed by punctuation, and hence + // not part of a [left-flanking delimiter run]: [TestFixture] public partial class TestInlinesEmphasisandstrongemphasis { @@ -9729,16 +9737,16 @@ namespace Markdig.Tests // Section: Inlines Emphasis and strong emphasis // // The following CommonMark: - // * a * + // a*"foo"* // // Should be rendered as: - //

* a *

+ //

a*"foo"*

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 330, "Inlines Emphasis and strong emphasis"); - TestParser.TestSpec("* a *", "

* a *

", ""); + TestParser.TestSpec("a*\"foo\"*", "

a*"foo"*

", ""); } } - // Intraword emphasis with `*` is permitted: + // Unicode nonbreaking spaces count as whitespace, too: [TestFixture] public partial class TestInlinesEmphasisandstrongemphasis { @@ -9749,15 +9757,16 @@ namespace Markdig.Tests // Section: Inlines Emphasis and strong emphasis // // The following CommonMark: - // foo*bar* + // * a * // // Should be rendered as: - //

foobar

+ //

* a *

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 331, "Inlines Emphasis and strong emphasis"); - TestParser.TestSpec("foo*bar*", "

foobar

", ""); + TestParser.TestSpec("* a *", "

* a *

", ""); } } + // Intraword emphasis with `*` is permitted: [TestFixture] public partial class TestInlinesEmphasisandstrongemphasis { @@ -9768,16 +9777,15 @@ namespace Markdig.Tests // Section: Inlines Emphasis and strong emphasis // // The following CommonMark: - // 5*6*78 + // foo*bar* // // Should be rendered as: - //

5678

+ //

foobar

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 332, "Inlines Emphasis and strong emphasis"); - TestParser.TestSpec("5*6*78", "

5678

", ""); + TestParser.TestSpec("foo*bar*", "

foobar

", ""); } } - // Rule 2: [TestFixture] public partial class TestInlinesEmphasisandstrongemphasis { @@ -9788,17 +9796,16 @@ namespace Markdig.Tests // Section: Inlines Emphasis and strong emphasis // // The following CommonMark: - // _foo bar_ + // 5*6*78 // // Should be rendered as: - //

foo bar

+ //

5678

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 333, "Inlines Emphasis and strong emphasis"); - TestParser.TestSpec("_foo bar_", "

foo bar

", ""); + TestParser.TestSpec("5*6*78", "

5678

", ""); } } - // This is not emphasis, because the opening `_` is followed by - // whitespace: + // Rule 2: [TestFixture] public partial class TestInlinesEmphasisandstrongemphasis { @@ -9809,17 +9816,17 @@ namespace Markdig.Tests // Section: Inlines Emphasis and strong emphasis // // The following CommonMark: - // _ foo bar_ + // _foo bar_ // // Should be rendered as: - //

_ foo bar_

+ //

foo bar

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 334, "Inlines Emphasis and strong emphasis"); - TestParser.TestSpec("_ foo bar_", "

_ foo bar_

", ""); + TestParser.TestSpec("_foo bar_", "

foo bar

", ""); } } - // This is not emphasis, because the opening `_` is preceded - // by an alphanumeric and followed by punctuation: + // This is not emphasis, because the opening `_` is followed by + // whitespace: [TestFixture] public partial class TestInlinesEmphasisandstrongemphasis { @@ -9830,16 +9837,17 @@ namespace Markdig.Tests // Section: Inlines Emphasis and strong emphasis // // The following CommonMark: - // a_"foo"_ + // _ foo bar_ // // Should be rendered as: - //

a_"foo"_

+ //

_ foo bar_

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 335, "Inlines Emphasis and strong emphasis"); - TestParser.TestSpec("a_\"foo\"_", "

a_"foo"_

", ""); + TestParser.TestSpec("_ foo bar_", "

_ foo bar_

", ""); } } - // Emphasis with `_` is not allowed inside words: + // This is not emphasis, because the opening `_` is preceded + // by an alphanumeric and followed by punctuation: [TestFixture] public partial class TestInlinesEmphasisandstrongemphasis { @@ -9850,15 +9858,16 @@ namespace Markdig.Tests // Section: Inlines Emphasis and strong emphasis // // The following CommonMark: - // foo_bar_ + // a_"foo"_ // // Should be rendered as: - //

foo_bar_

+ //

a_"foo"_

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 336, "Inlines Emphasis and strong emphasis"); - TestParser.TestSpec("foo_bar_", "

foo_bar_

", ""); + TestParser.TestSpec("a_\"foo\"_", "

a_"foo"_

", ""); } } + // Emphasis with `_` is not allowed inside words: [TestFixture] public partial class TestInlinesEmphasisandstrongemphasis { @@ -9869,13 +9878,13 @@ namespace Markdig.Tests // Section: Inlines Emphasis and strong emphasis // // The following CommonMark: - // 5_6_78 + // foo_bar_ // // Should be rendered as: - //

5_6_78

+ //

foo_bar_

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 337, "Inlines Emphasis and strong emphasis"); - TestParser.TestSpec("5_6_78", "

5_6_78

", ""); + TestParser.TestSpec("foo_bar_", "

foo_bar_

", ""); } } [TestFixture] @@ -9888,17 +9897,15 @@ namespace Markdig.Tests // Section: Inlines Emphasis and strong emphasis // // The following CommonMark: - // пристаням_стремятся_ + // 5_6_78 // // Should be rendered as: - //

пристаням_стремятся_

+ //

5_6_78

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 338, "Inlines Emphasis and strong emphasis"); - TestParser.TestSpec("пристаням_стремятся_", "

пристаням_стремятся_

", ""); + TestParser.TestSpec("5_6_78", "

5_6_78

", ""); } } - // Here `_` does not generate emphasis, because the first delimiter run - // is right-flanking and the second left-flanking: [TestFixture] public partial class TestInlinesEmphasisandstrongemphasis { @@ -9909,18 +9916,17 @@ namespace Markdig.Tests // Section: Inlines Emphasis and strong emphasis // // The following CommonMark: - // aa_"bb"_cc + // пристаням_стремятся_ // // Should be rendered as: - //

aa_"bb"_cc

+ //

пристаням_стремятся_

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 339, "Inlines Emphasis and strong emphasis"); - TestParser.TestSpec("aa_\"bb\"_cc", "

aa_"bb"_cc

", ""); + TestParser.TestSpec("пристаням_стремятся_", "

пристаням_стремятся_

", ""); } } - // This is emphasis, even though the opening delimiter is - // both left- and right-flanking, because it is preceded by - // punctuation: + // Here `_` does not generate emphasis, because the first delimiter run + // is right-flanking and the second left-flanking: [TestFixture] public partial class TestInlinesEmphasisandstrongemphasis { @@ -9931,12 +9937,34 @@ namespace Markdig.Tests // Section: Inlines Emphasis and strong emphasis // // The following CommonMark: + // aa_"bb"_cc + // + // Should be rendered as: + //

aa_"bb"_cc

+ + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 340, "Inlines Emphasis and strong emphasis"); + TestParser.TestSpec("aa_\"bb\"_cc", "

aa_"bb"_cc

", ""); + } + } + // This is emphasis, even though the opening delimiter is + // both left- and right-flanking, because it is preceded by + // punctuation: + [TestFixture] + public partial class TestInlinesEmphasisandstrongemphasis + { + [Test] + public void Example341() + { + // Example 341 + // Section: Inlines Emphasis and strong emphasis + // + // The following CommonMark: // foo-_(bar)_ // // Should be rendered as: //

foo-(bar)

- Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 340, "Inlines Emphasis and strong emphasis"); + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 341, "Inlines Emphasis and strong emphasis"); TestParser.TestSpec("foo-_(bar)_", "

foo-(bar)

", ""); } } @@ -9948,9 +9976,9 @@ namespace Markdig.Tests public partial class TestInlinesEmphasisandstrongemphasis { [Test] - public void Example341() + public void Example342() { - // Example 341 + // Example 342 // Section: Inlines Emphasis and strong emphasis // // The following CommonMark: @@ -9959,7 +9987,7 @@ namespace Markdig.Tests // Should be rendered as: //

_foo*

- Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 341, "Inlines Emphasis and strong emphasis"); + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 342, "Inlines Emphasis and strong emphasis"); TestParser.TestSpec("_foo*", "

_foo*

", ""); } } @@ -9967,26 +9995,6 @@ namespace Markdig.Tests // whitespace: [TestFixture] public partial class TestInlinesEmphasisandstrongemphasis - { - [Test] - public void Example342() - { - // Example 342 - // Section: Inlines Emphasis and strong emphasis - // - // The following CommonMark: - // *foo bar * - // - // Should be rendered as: - //

*foo bar *

- - Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 342, "Inlines Emphasis and strong emphasis"); - TestParser.TestSpec("*foo bar *", "

*foo bar *

", ""); - } - } - // A newline also counts as whitespace: - [TestFixture] - public partial class TestInlinesEmphasisandstrongemphasis { [Test] public void Example343() @@ -9995,20 +10003,16 @@ namespace Markdig.Tests // Section: Inlines Emphasis and strong emphasis // // The following CommonMark: - // *foo bar - // * + // *foo bar * // // Should be rendered as: - //

*foo bar - // *

+ //

*foo bar *

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 343, "Inlines Emphasis and strong emphasis"); - TestParser.TestSpec("*foo bar\n*", "

*foo bar\n*

", ""); + TestParser.TestSpec("*foo bar *", "

*foo bar *

", ""); } } - // This is not emphasis, because the second `*` is - // preceded by punctuation and followed by an alphanumeric - // (hence it is not part of a [right-flanking delimiter run]: + // A newline also counts as whitespace: [TestFixture] public partial class TestInlinesEmphasisandstrongemphasis { @@ -10019,17 +10023,20 @@ namespace Markdig.Tests // Section: Inlines Emphasis and strong emphasis // // The following CommonMark: - // *(*foo) + // *foo bar + // * // // Should be rendered as: - //

*(*foo)

+ //

*foo bar + // *

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 344, "Inlines Emphasis and strong emphasis"); - TestParser.TestSpec("*(*foo)", "

*(*foo)

", ""); + TestParser.TestSpec("*foo bar\n*", "

*foo bar\n*

", ""); } } - // The point of this restriction is more easily appreciated - // with this example: + // This is not emphasis, because the second `*` is + // preceded by punctuation and followed by an alphanumeric + // (hence it is not part of a [right-flanking delimiter run]: [TestFixture] public partial class TestInlinesEmphasisandstrongemphasis { @@ -10040,16 +10047,17 @@ namespace Markdig.Tests // Section: Inlines Emphasis and strong emphasis // // The following CommonMark: - // *(*foo*)* + // *(*foo) // // Should be rendered as: - //

(foo)

+ //

*(*foo)

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 345, "Inlines Emphasis and strong emphasis"); - TestParser.TestSpec("*(*foo*)*", "

(foo)

", ""); + TestParser.TestSpec("*(*foo)", "

*(*foo)

", ""); } } - // Intraword emphasis with `*` is allowed: + // The point of this restriction is more easily appreciated + // with this example: [TestFixture] public partial class TestInlinesEmphasisandstrongemphasis { @@ -10060,12 +10068,32 @@ namespace Markdig.Tests // Section: Inlines Emphasis and strong emphasis // // The following CommonMark: + // *(*foo*)* + // + // Should be rendered as: + //

(foo)

+ + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 346, "Inlines Emphasis and strong emphasis"); + TestParser.TestSpec("*(*foo*)*", "

(foo)

", ""); + } + } + // Intraword emphasis with `*` is allowed: + [TestFixture] + public partial class TestInlinesEmphasisandstrongemphasis + { + [Test] + public void Example347() + { + // Example 347 + // Section: Inlines Emphasis and strong emphasis + // + // The following CommonMark: // *foo*bar // // Should be rendered as: //

foobar

- Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 346, "Inlines Emphasis and strong emphasis"); + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 347, "Inlines Emphasis and strong emphasis"); TestParser.TestSpec("*foo*bar", "

foobar

", ""); } } @@ -10077,9 +10105,9 @@ namespace Markdig.Tests public partial class TestInlinesEmphasisandstrongemphasis { [Test] - public void Example347() + public void Example348() { - // Example 347 + // Example 348 // Section: Inlines Emphasis and strong emphasis // // The following CommonMark: @@ -10088,7 +10116,7 @@ namespace Markdig.Tests // Should be rendered as: //

_foo bar _

- Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 347, "Inlines Emphasis and strong emphasis"); + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 348, "Inlines Emphasis and strong emphasis"); TestParser.TestSpec("_foo bar _", "

_foo bar _

", ""); } } @@ -10096,26 +10124,6 @@ namespace Markdig.Tests // preceded by punctuation and followed by an alphanumeric: [TestFixture] public partial class TestInlinesEmphasisandstrongemphasis - { - [Test] - public void Example348() - { - // Example 348 - // Section: Inlines Emphasis and strong emphasis - // - // The following CommonMark: - // _(_foo) - // - // Should be rendered as: - //

_(_foo)

- - Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 348, "Inlines Emphasis and strong emphasis"); - TestParser.TestSpec("_(_foo)", "

_(_foo)

", ""); - } - } - // This is emphasis within emphasis: - [TestFixture] - public partial class TestInlinesEmphasisandstrongemphasis { [Test] public void Example349() @@ -10124,16 +10132,16 @@ namespace Markdig.Tests // Section: Inlines Emphasis and strong emphasis // // The following CommonMark: - // _(_foo_)_ + // _(_foo) // // Should be rendered as: - //

(foo)

+ //

_(_foo)

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 349, "Inlines Emphasis and strong emphasis"); - TestParser.TestSpec("_(_foo_)_", "

(foo)

", ""); + TestParser.TestSpec("_(_foo)", "

_(_foo)

", ""); } } - // Intraword emphasis is disallowed for `_`: + // This is emphasis within emphasis: [TestFixture] public partial class TestInlinesEmphasisandstrongemphasis { @@ -10144,15 +10152,16 @@ namespace Markdig.Tests // Section: Inlines Emphasis and strong emphasis // // The following CommonMark: - // _foo_bar + // _(_foo_)_ // // Should be rendered as: - //

_foo_bar

+ //

(foo)

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 350, "Inlines Emphasis and strong emphasis"); - TestParser.TestSpec("_foo_bar", "

_foo_bar

", ""); + TestParser.TestSpec("_(_foo_)_", "

(foo)

", ""); } } + // Intraword emphasis is disallowed for `_`: [TestFixture] public partial class TestInlinesEmphasisandstrongemphasis { @@ -10163,13 +10172,13 @@ namespace Markdig.Tests // Section: Inlines Emphasis and strong emphasis // // The following CommonMark: - // _пристаням_стремятся + // _foo_bar // // Should be rendered as: - //

_пристаням_стремятся

+ //

_foo_bar

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 351, "Inlines Emphasis and strong emphasis"); - TestParser.TestSpec("_пристаням_стремятся", "

_пристаням_стремятся

", ""); + TestParser.TestSpec("_foo_bar", "

_foo_bar

", ""); } } [TestFixture] @@ -10182,18 +10191,15 @@ namespace Markdig.Tests // Section: Inlines Emphasis and strong emphasis // // The following CommonMark: - // _foo_bar_baz_ + // _пристаням_стремятся // // Should be rendered as: - //

foo_bar_baz

+ //

_пристаням_стремятся

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 352, "Inlines Emphasis and strong emphasis"); - TestParser.TestSpec("_foo_bar_baz_", "

foo_bar_baz

", ""); + TestParser.TestSpec("_пристаням_стремятся", "

_пристаням_стремятся

", ""); } } - // This is emphasis, even though the closing delimiter is - // both left- and right-flanking, because it is followed by - // punctuation: [TestFixture] public partial class TestInlinesEmphasisandstrongemphasis { @@ -10204,16 +10210,18 @@ namespace Markdig.Tests // Section: Inlines Emphasis and strong emphasis // // The following CommonMark: - // _(bar)_. + // _foo_bar_baz_ // // Should be rendered as: - //

(bar).

+ //

foo_bar_baz

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 353, "Inlines Emphasis and strong emphasis"); - TestParser.TestSpec("_(bar)_.", "

(bar).

", ""); + TestParser.TestSpec("_foo_bar_baz_", "

foo_bar_baz

", ""); } } - // Rule 5: + // This is emphasis, even though the closing delimiter is + // both left- and right-flanking, because it is followed by + // punctuation: [TestFixture] public partial class TestInlinesEmphasisandstrongemphasis { @@ -10224,17 +10232,16 @@ namespace Markdig.Tests // Section: Inlines Emphasis and strong emphasis // // The following CommonMark: - // **foo bar** + // _(bar)_. // // Should be rendered as: - //

foo bar

+ //

(bar).

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 354, "Inlines Emphasis and strong emphasis"); - TestParser.TestSpec("**foo bar**", "

foo bar

", ""); + TestParser.TestSpec("_(bar)_.", "

(bar).

", ""); } } - // This is not strong emphasis, because the opening delimiter is - // followed by whitespace: + // Rule 5: [TestFixture] public partial class TestInlinesEmphasisandstrongemphasis { @@ -10245,18 +10252,17 @@ namespace Markdig.Tests // Section: Inlines Emphasis and strong emphasis // // The following CommonMark: - // ** foo bar** + // **foo bar** // // Should be rendered as: - //

** foo bar**

+ //

foo bar

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 355, "Inlines Emphasis and strong emphasis"); - TestParser.TestSpec("** foo bar**", "

** foo bar**

", ""); + TestParser.TestSpec("**foo bar**", "

foo bar

", ""); } } - // This is not strong emphasis, because the opening `**` is preceded - // by an alphanumeric and followed by punctuation, and hence - // not part of a [left-flanking delimiter run]: + // This is not strong emphasis, because the opening delimiter is + // followed by whitespace: [TestFixture] public partial class TestInlinesEmphasisandstrongemphasis { @@ -10267,16 +10273,18 @@ namespace Markdig.Tests // Section: Inlines Emphasis and strong emphasis // // The following CommonMark: - // a**"foo"** + // ** foo bar** // // Should be rendered as: - //

a**"foo"**

+ //

** foo bar**

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 356, "Inlines Emphasis and strong emphasis"); - TestParser.TestSpec("a**\"foo\"**", "

a**"foo"**

", ""); + TestParser.TestSpec("** foo bar**", "

** foo bar**

", ""); } } - // Intraword strong emphasis with `**` is permitted: + // This is not strong emphasis, because the opening `**` is preceded + // by an alphanumeric and followed by punctuation, and hence + // not part of a [left-flanking delimiter run]: [TestFixture] public partial class TestInlinesEmphasisandstrongemphasis { @@ -10287,16 +10295,16 @@ namespace Markdig.Tests // Section: Inlines Emphasis and strong emphasis // // The following CommonMark: - // foo**bar** + // a**"foo"** // // Should be rendered as: - //

foobar

+ //

a**"foo"**

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 357, "Inlines Emphasis and strong emphasis"); - TestParser.TestSpec("foo**bar**", "

foobar

", ""); + TestParser.TestSpec("a**\"foo\"**", "

a**"foo"**

", ""); } } - // Rule 6: + // Intraword strong emphasis with `**` is permitted: [TestFixture] public partial class TestInlinesEmphasisandstrongemphasis { @@ -10307,17 +10315,16 @@ namespace Markdig.Tests // Section: Inlines Emphasis and strong emphasis // // The following CommonMark: - // __foo bar__ + // foo**bar** // // Should be rendered as: - //

foo bar

+ //

foobar

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 358, "Inlines Emphasis and strong emphasis"); - TestParser.TestSpec("__foo bar__", "

foo bar

", ""); + TestParser.TestSpec("foo**bar**", "

foobar

", ""); } } - // This is not strong emphasis, because the opening delimiter is - // followed by whitespace: + // Rule 6: [TestFixture] public partial class TestInlinesEmphasisandstrongemphasis { @@ -10328,16 +10335,17 @@ namespace Markdig.Tests // Section: Inlines Emphasis and strong emphasis // // The following CommonMark: - // __ foo bar__ + // __foo bar__ // // Should be rendered as: - //

__ foo bar__

+ //

foo bar

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 359, "Inlines Emphasis and strong emphasis"); - TestParser.TestSpec("__ foo bar__", "

__ foo bar__

", ""); + TestParser.TestSpec("__foo bar__", "

foo bar

", ""); } } - // A newline counts as whitespace: + // This is not strong emphasis, because the opening delimiter is + // followed by whitespace: [TestFixture] public partial class TestInlinesEmphasisandstrongemphasis { @@ -10348,19 +10356,16 @@ namespace Markdig.Tests // Section: Inlines Emphasis and strong emphasis // // The following CommonMark: - // __ - // foo bar__ + // __ foo bar__ // // Should be rendered as: - //

__ - // foo bar__

+ //

__ foo bar__

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 360, "Inlines Emphasis and strong emphasis"); - TestParser.TestSpec("__\nfoo bar__", "

__\nfoo bar__

", ""); + TestParser.TestSpec("__ foo bar__", "

__ foo bar__

", ""); } } - // This is not strong emphasis, because the opening `__` is preceded - // by an alphanumeric and followed by punctuation: + // A newline counts as whitespace: [TestFixture] public partial class TestInlinesEmphasisandstrongemphasis { @@ -10371,16 +10376,19 @@ namespace Markdig.Tests // Section: Inlines Emphasis and strong emphasis // // The following CommonMark: - // a__"foo"__ + // __ + // foo bar__ // // Should be rendered as: - //

a__"foo"__

+ //

__ + // foo bar__

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 361, "Inlines Emphasis and strong emphasis"); - TestParser.TestSpec("a__\"foo\"__", "

a__"foo"__

", ""); + TestParser.TestSpec("__\nfoo bar__", "

__\nfoo bar__

", ""); } } - // Intraword strong emphasis is forbidden with `__`: + // This is not strong emphasis, because the opening `__` is preceded + // by an alphanumeric and followed by punctuation: [TestFixture] public partial class TestInlinesEmphasisandstrongemphasis { @@ -10391,15 +10399,16 @@ namespace Markdig.Tests // Section: Inlines Emphasis and strong emphasis // // The following CommonMark: - // foo__bar__ + // a__"foo"__ // // Should be rendered as: - //

foo__bar__

+ //

a__"foo"__

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 362, "Inlines Emphasis and strong emphasis"); - TestParser.TestSpec("foo__bar__", "

foo__bar__

", ""); + TestParser.TestSpec("a__\"foo\"__", "

a__"foo"__

", ""); } } + // Intraword strong emphasis is forbidden with `__`: [TestFixture] public partial class TestInlinesEmphasisandstrongemphasis { @@ -10410,13 +10419,13 @@ namespace Markdig.Tests // Section: Inlines Emphasis and strong emphasis // // The following CommonMark: - // 5__6__78 + // foo__bar__ // // Should be rendered as: - //

5__6__78

+ //

foo__bar__

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 363, "Inlines Emphasis and strong emphasis"); - TestParser.TestSpec("5__6__78", "

5__6__78

", ""); + TestParser.TestSpec("foo__bar__", "

foo__bar__

", ""); } } [TestFixture] @@ -10429,13 +10438,13 @@ namespace Markdig.Tests // Section: Inlines Emphasis and strong emphasis // // The following CommonMark: - // пристаням__стремятся__ + // 5__6__78 // // Should be rendered as: - //

пристаням__стремятся__

+ //

5__6__78

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 364, "Inlines Emphasis and strong emphasis"); - TestParser.TestSpec("пристаням__стремятся__", "

пристаням__стремятся__

", ""); + TestParser.TestSpec("5__6__78", "

5__6__78

", ""); } } [TestFixture] @@ -10448,18 +10457,15 @@ namespace Markdig.Tests // Section: Inlines Emphasis and strong emphasis // // The following CommonMark: - // __foo, __bar__, baz__ + // пристаням__стремятся__ // // Should be rendered as: - //

foo, bar, baz

+ //

пристаням__стремятся__

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 365, "Inlines Emphasis and strong emphasis"); - TestParser.TestSpec("__foo, __bar__, baz__", "

foo, bar, baz

", ""); + TestParser.TestSpec("пристаням__стремятся__", "

пристаням__стремятся__

", ""); } } - // This is strong emphasis, even though the opening delimiter is - // both left- and right-flanking, because it is preceded by - // punctuation: [TestFixture] public partial class TestInlinesEmphasisandstrongemphasis { @@ -10470,12 +10476,34 @@ namespace Markdig.Tests // Section: Inlines Emphasis and strong emphasis // // The following CommonMark: + // __foo, __bar__, baz__ + // + // Should be rendered as: + //

foo, bar, baz

+ + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 366, "Inlines Emphasis and strong emphasis"); + TestParser.TestSpec("__foo, __bar__, baz__", "

foo, bar, baz

", ""); + } + } + // This is strong emphasis, even though the opening delimiter is + // both left- and right-flanking, because it is preceded by + // punctuation: + [TestFixture] + public partial class TestInlinesEmphasisandstrongemphasis + { + [Test] + public void Example367() + { + // Example 367 + // Section: Inlines Emphasis and strong emphasis + // + // The following CommonMark: // foo-__(bar)__ // // Should be rendered as: //

foo-(bar)

- Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 366, "Inlines Emphasis and strong emphasis"); + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 367, "Inlines Emphasis and strong emphasis"); TestParser.TestSpec("foo-__(bar)__", "

foo-(bar)

", ""); } } @@ -10487,9 +10515,9 @@ namespace Markdig.Tests public partial class TestInlinesEmphasisandstrongemphasis { [Test] - public void Example367() + public void Example368() { - // Example 367 + // Example 368 // Section: Inlines Emphasis and strong emphasis // // The following CommonMark: @@ -10498,7 +10526,7 @@ namespace Markdig.Tests // Should be rendered as: //

**foo bar **

- Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 367, "Inlines Emphasis and strong emphasis"); + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 368, "Inlines Emphasis and strong emphasis"); TestParser.TestSpec("**foo bar **", "

**foo bar **

", ""); } } @@ -10511,9 +10539,9 @@ namespace Markdig.Tests public partial class TestInlinesEmphasisandstrongemphasis { [Test] - public void Example368() + public void Example369() { - // Example 368 + // Example 369 // Section: Inlines Emphasis and strong emphasis // // The following CommonMark: @@ -10522,7 +10550,7 @@ namespace Markdig.Tests // Should be rendered as: //

**(**foo)

- Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 368, "Inlines Emphasis and strong emphasis"); + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 369, "Inlines Emphasis and strong emphasis"); TestParser.TestSpec("**(**foo)", "

**(**foo)

", ""); } } @@ -10530,25 +10558,6 @@ namespace Markdig.Tests // with these examples: [TestFixture] public partial class TestInlinesEmphasisandstrongemphasis - { - [Test] - public void Example369() - { - // Example 369 - // Section: Inlines Emphasis and strong emphasis - // - // The following CommonMark: - // *(**foo**)* - // - // Should be rendered as: - //

(foo)

- - Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 369, "Inlines Emphasis and strong emphasis"); - TestParser.TestSpec("*(**foo**)*", "

(foo)

", ""); - } - } - [TestFixture] - public partial class TestInlinesEmphasisandstrongemphasis { [Test] public void Example370() @@ -10557,15 +10566,13 @@ namespace Markdig.Tests // Section: Inlines Emphasis and strong emphasis // // The following CommonMark: - // **Gomphocarpus (*Gomphocarpus physocarpus*, syn. - // *Asclepias physocarpa*)** + // *(**foo**)* // // Should be rendered as: - //

Gomphocarpus (Gomphocarpus physocarpus, syn. - // Asclepias physocarpa)

+ //

(foo)

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 370, "Inlines Emphasis and strong emphasis"); - TestParser.TestSpec("**Gomphocarpus (*Gomphocarpus physocarpus*, syn.\n*Asclepias physocarpa*)**", "

Gomphocarpus (Gomphocarpus physocarpus, syn.\nAsclepias physocarpa)

", ""); + TestParser.TestSpec("*(**foo**)*", "

(foo)

", ""); } } [TestFixture] @@ -10578,16 +10585,17 @@ namespace Markdig.Tests // Section: Inlines Emphasis and strong emphasis // // The following CommonMark: - // **foo "*bar*" foo** + // **Gomphocarpus (*Gomphocarpus physocarpus*, syn. + // *Asclepias physocarpa*)** // // Should be rendered as: - //

foo "bar" foo

+ //

Gomphocarpus (Gomphocarpus physocarpus, syn. + // Asclepias physocarpa)

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 371, "Inlines Emphasis and strong emphasis"); - TestParser.TestSpec("**foo \"*bar*\" foo**", "

foo "bar" foo

", ""); + TestParser.TestSpec("**Gomphocarpus (*Gomphocarpus physocarpus*, syn.\n*Asclepias physocarpa*)**", "

Gomphocarpus (Gomphocarpus physocarpus, syn.\nAsclepias physocarpa)

", ""); } } - // Intraword emphasis: [TestFixture] public partial class TestInlinesEmphasisandstrongemphasis { @@ -10598,12 +10606,32 @@ namespace Markdig.Tests // Section: Inlines Emphasis and strong emphasis // // The following CommonMark: + // **foo "*bar*" foo** + // + // Should be rendered as: + //

foo "bar" foo

+ + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 372, "Inlines Emphasis and strong emphasis"); + TestParser.TestSpec("**foo \"*bar*\" foo**", "

foo "bar" foo

", ""); + } + } + // Intraword emphasis: + [TestFixture] + public partial class TestInlinesEmphasisandstrongemphasis + { + [Test] + public void Example373() + { + // Example 373 + // Section: Inlines Emphasis and strong emphasis + // + // The following CommonMark: // **foo**bar // // Should be rendered as: //

foobar

- Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 372, "Inlines Emphasis and strong emphasis"); + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 373, "Inlines Emphasis and strong emphasis"); TestParser.TestSpec("**foo**bar", "

foobar

", ""); } } @@ -10615,9 +10643,9 @@ namespace Markdig.Tests public partial class TestInlinesEmphasisandstrongemphasis { [Test] - public void Example373() + public void Example374() { - // Example 373 + // Example 374 // Section: Inlines Emphasis and strong emphasis // // The following CommonMark: @@ -10626,7 +10654,7 @@ namespace Markdig.Tests // Should be rendered as: //

__foo bar __

- Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 373, "Inlines Emphasis and strong emphasis"); + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 374, "Inlines Emphasis and strong emphasis"); TestParser.TestSpec("__foo bar __", "

__foo bar __

", ""); } } @@ -10634,27 +10662,6 @@ namespace Markdig.Tests // preceded by punctuation and followed by an alphanumeric: [TestFixture] public partial class TestInlinesEmphasisandstrongemphasis - { - [Test] - public void Example374() - { - // Example 374 - // Section: Inlines Emphasis and strong emphasis - // - // The following CommonMark: - // __(__foo) - // - // Should be rendered as: - //

__(__foo)

- - Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 374, "Inlines Emphasis and strong emphasis"); - TestParser.TestSpec("__(__foo)", "

__(__foo)

", ""); - } - } - // The point of this restriction is more easily appreciated - // with this example: - [TestFixture] - public partial class TestInlinesEmphasisandstrongemphasis { [Test] public void Example375() @@ -10663,16 +10670,17 @@ namespace Markdig.Tests // Section: Inlines Emphasis and strong emphasis // // The following CommonMark: - // _(__foo__)_ + // __(__foo) // // Should be rendered as: - //

(foo)

+ //

__(__foo)

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 375, "Inlines Emphasis and strong emphasis"); - TestParser.TestSpec("_(__foo__)_", "

(foo)

", ""); + TestParser.TestSpec("__(__foo)", "

__(__foo)

", ""); } } - // Intraword strong emphasis is forbidden with `__`: + // The point of this restriction is more easily appreciated + // with this example: [TestFixture] public partial class TestInlinesEmphasisandstrongemphasis { @@ -10683,15 +10691,16 @@ namespace Markdig.Tests // Section: Inlines Emphasis and strong emphasis // // The following CommonMark: - // __foo__bar + // _(__foo__)_ // // Should be rendered as: - //

__foo__bar

+ //

(foo)

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 376, "Inlines Emphasis and strong emphasis"); - TestParser.TestSpec("__foo__bar", "

__foo__bar

", ""); + TestParser.TestSpec("_(__foo__)_", "

(foo)

", ""); } } + // Intraword strong emphasis is forbidden with `__`: [TestFixture] public partial class TestInlinesEmphasisandstrongemphasis { @@ -10702,13 +10711,13 @@ namespace Markdig.Tests // Section: Inlines Emphasis and strong emphasis // // The following CommonMark: - // __пристаням__стремятся + // __foo__bar // // Should be rendered as: - //

__пристаням__стремятся

+ //

__foo__bar

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 377, "Inlines Emphasis and strong emphasis"); - TestParser.TestSpec("__пристаням__стремятся", "

__пристаням__стремятся

", ""); + TestParser.TestSpec("__foo__bar", "

__foo__bar

", ""); } } [TestFixture] @@ -10721,18 +10730,15 @@ namespace Markdig.Tests // Section: Inlines Emphasis and strong emphasis // // The following CommonMark: - // __foo__bar__baz__ + // __пристаням__стремятся // // Should be rendered as: - //

foo__bar__baz

+ //

__пристаням__стремятся

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 378, "Inlines Emphasis and strong emphasis"); - TestParser.TestSpec("__foo__bar__baz__", "

foo__bar__baz

", ""); + TestParser.TestSpec("__пристаням__стремятся", "

__пристаням__стремятся

", ""); } } - // This is strong emphasis, even though the closing delimiter is - // both left- and right-flanking, because it is followed by - // punctuation: [TestFixture] public partial class TestInlinesEmphasisandstrongemphasis { @@ -10743,12 +10749,34 @@ namespace Markdig.Tests // Section: Inlines Emphasis and strong emphasis // // The following CommonMark: + // __foo__bar__baz__ + // + // Should be rendered as: + //

foo__bar__baz

+ + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 379, "Inlines Emphasis and strong emphasis"); + TestParser.TestSpec("__foo__bar__baz__", "

foo__bar__baz

", ""); + } + } + // This is strong emphasis, even though the closing delimiter is + // both left- and right-flanking, because it is followed by + // punctuation: + [TestFixture] + public partial class TestInlinesEmphasisandstrongemphasis + { + [Test] + public void Example380() + { + // Example 380 + // Section: Inlines Emphasis and strong emphasis + // + // The following CommonMark: // __(bar)__. // // Should be rendered as: //

(bar).

- Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 379, "Inlines Emphasis and strong emphasis"); + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 380, "Inlines Emphasis and strong emphasis"); TestParser.TestSpec("__(bar)__.", "

(bar).

", ""); } } @@ -10760,9 +10788,9 @@ namespace Markdig.Tests public partial class TestInlinesEmphasisandstrongemphasis { [Test] - public void Example380() + public void Example381() { - // Example 380 + // Example 381 // Section: Inlines Emphasis and strong emphasis // // The following CommonMark: @@ -10771,35 +10799,12 @@ namespace Markdig.Tests // Should be rendered as: //

foo bar

- Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 380, "Inlines Emphasis and strong emphasis"); + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 381, "Inlines Emphasis and strong emphasis"); TestParser.TestSpec("*foo [bar](/url)*", "

foo bar

", ""); } } [TestFixture] public partial class TestInlinesEmphasisandstrongemphasis - { - [Test] - public void Example381() - { - // Example 381 - // Section: Inlines Emphasis and strong emphasis - // - // The following CommonMark: - // *foo - // bar* - // - // Should be rendered as: - //

foo - // bar

- - Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 381, "Inlines Emphasis and strong emphasis"); - TestParser.TestSpec("*foo\nbar*", "

foo\nbar

", ""); - } - } - // In particular, emphasis and strong emphasis can be nested - // inside emphasis: - [TestFixture] - public partial class TestInlinesEmphasisandstrongemphasis { [Test] public void Example382() @@ -10808,15 +10813,19 @@ namespace Markdig.Tests // Section: Inlines Emphasis and strong emphasis // // The following CommonMark: - // _foo __bar__ baz_ + // *foo + // bar* // // Should be rendered as: - //

foo bar baz

+ //

foo + // bar

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 382, "Inlines Emphasis and strong emphasis"); - TestParser.TestSpec("_foo __bar__ baz_", "

foo bar baz

", ""); + TestParser.TestSpec("*foo\nbar*", "

foo\nbar

", ""); } } + // In particular, emphasis and strong emphasis can be nested + // inside emphasis: [TestFixture] public partial class TestInlinesEmphasisandstrongemphasis { @@ -10827,13 +10836,13 @@ namespace Markdig.Tests // Section: Inlines Emphasis and strong emphasis // // The following CommonMark: - // _foo _bar_ baz_ + // _foo __bar__ baz_ // // Should be rendered as: - //

foo bar baz

+ //

foo bar baz

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 383, "Inlines Emphasis and strong emphasis"); - TestParser.TestSpec("_foo _bar_ baz_", "

foo bar baz

", ""); + TestParser.TestSpec("_foo __bar__ baz_", "

foo bar baz

", ""); } } [TestFixture] @@ -10846,13 +10855,13 @@ namespace Markdig.Tests // Section: Inlines Emphasis and strong emphasis // // The following CommonMark: - // __foo_ bar_ + // _foo _bar_ baz_ // // Should be rendered as: - //

foo bar

+ //

foo bar baz

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 384, "Inlines Emphasis and strong emphasis"); - TestParser.TestSpec("__foo_ bar_", "

foo bar

", ""); + TestParser.TestSpec("_foo _bar_ baz_", "

foo bar baz

", ""); } } [TestFixture] @@ -10865,13 +10874,13 @@ namespace Markdig.Tests // Section: Inlines Emphasis and strong emphasis // // The following CommonMark: - // *foo *bar** + // __foo_ bar_ // // Should be rendered as: - //

foo bar

+ //

foo bar

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 385, "Inlines Emphasis and strong emphasis"); - TestParser.TestSpec("*foo *bar**", "

foo bar

", ""); + TestParser.TestSpec("__foo_ bar_", "

foo bar

", ""); } } [TestFixture] @@ -10884,13 +10893,13 @@ namespace Markdig.Tests // Section: Inlines Emphasis and strong emphasis // // The following CommonMark: - // *foo **bar** baz* + // *foo *bar** // // Should be rendered as: - //

foo bar baz

+ //

foo bar

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 386, "Inlines Emphasis and strong emphasis"); - TestParser.TestSpec("*foo **bar** baz*", "

foo bar baz

", ""); + TestParser.TestSpec("*foo *bar**", "

foo bar

", ""); } } [TestFixture] @@ -10903,12 +10912,31 @@ namespace Markdig.Tests // Section: Inlines Emphasis and strong emphasis // // The following CommonMark: + // *foo **bar** baz* + // + // Should be rendered as: + //

foo bar baz

+ + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 387, "Inlines Emphasis and strong emphasis"); + TestParser.TestSpec("*foo **bar** baz*", "

foo bar baz

", ""); + } + } + [TestFixture] + public partial class TestInlinesEmphasisandstrongemphasis + { + [Test] + public void Example388() + { + // Example 388 + // Section: Inlines Emphasis and strong emphasis + // + // The following CommonMark: // *foo**bar**baz* // // Should be rendered as: //

foobarbaz

- Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 387, "Inlines Emphasis and strong emphasis"); + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 388, "Inlines Emphasis and strong emphasis"); TestParser.TestSpec("*foo**bar**baz*", "

foobarbaz

", ""); } } @@ -10919,7 +10947,7 @@ namespace Markdig.Tests // ``` // // is precluded by the condition that a delimiter that - // can both open and close (like the `*` after `foo` + // can both open and close (like the `*` after `foo`) // cannot form emphasis if the sum of the lengths of // the delimiter runs containing the opening and // closing delimiters is a multiple of 3. @@ -10932,9 +10960,9 @@ namespace Markdig.Tests public partial class TestInlinesEmphasisandstrongemphasis { [Test] - public void Example388() + public void Example389() { - // Example 388 + // Example 389 // Section: Inlines Emphasis and strong emphasis // // The following CommonMark: @@ -10943,27 +10971,8 @@ namespace Markdig.Tests // Should be rendered as: //

foo bar

- Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 388, "Inlines Emphasis and strong emphasis"); - TestParser.TestSpec("***foo** bar*", "

foo bar

", ""); - } - } - [TestFixture] - public partial class TestInlinesEmphasisandstrongemphasis - { - [Test] - public void Example389() - { - // Example 389 - // Section: Inlines Emphasis and strong emphasis - // - // The following CommonMark: - // *foo **bar*** - // - // Should be rendered as: - //

foo bar

- Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 389, "Inlines Emphasis and strong emphasis"); - TestParser.TestSpec("*foo **bar***", "

foo bar

", ""); + TestParser.TestSpec("***foo** bar*", "

foo bar

", ""); } } [TestFixture] @@ -10976,13 +10985,13 @@ namespace Markdig.Tests // Section: Inlines Emphasis and strong emphasis // // The following CommonMark: - // *foo**bar*** + // *foo **bar*** // // Should be rendered as: - //

foobar

+ //

foo bar

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 390, "Inlines Emphasis and strong emphasis"); - TestParser.TestSpec("*foo**bar***", "

foobar

", ""); + TestParser.TestSpec("*foo **bar***", "

foo bar

", ""); } } [TestFixture] @@ -12744,7 +12753,8 @@ namespace Markdig.Tests TestParser.TestSpec("[link](/url \"title \\\""\")", "

link

", ""); } } - // Nested balanced quotes are not allowed without escaping: + // Titles must be separated from the link using a [whitespace]. + // Other [Unicode whitespace] like non-breaking space doesn't work. [TestFixture] public partial class TestInlinesLinks { @@ -12755,16 +12765,16 @@ namespace Markdig.Tests // Section: Inlines Links // // The following CommonMark: - // [link](/url "title "and" title") + // [link](/url "title") // // Should be rendered as: - //

[link](/url "title "and" title")

+ //

link

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 476, "Inlines Links"); - TestParser.TestSpec("[link](/url \"title \"and\" title\")", "

[link](/url "title "and" title")

", ""); + TestParser.TestSpec("[link](/url \"title\")", "

link

", ""); } } - // But it is easy to work around this by using a different quote type: + // Nested balanced quotes are not allowed without escaping: [TestFixture] public partial class TestInlinesLinks { @@ -12775,12 +12785,32 @@ namespace Markdig.Tests // Section: Inlines Links // // The following CommonMark: + // [link](/url "title "and" title") + // + // Should be rendered as: + //

[link](/url "title "and" title")

+ + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 477, "Inlines Links"); + TestParser.TestSpec("[link](/url \"title \"and\" title\")", "

[link](/url "title "and" title")

", ""); + } + } + // But it is easy to work around this by using a different quote type: + [TestFixture] + public partial class TestInlinesLinks + { + [Test] + public void Example478() + { + // Example 478 + // Section: Inlines Links + // + // The following CommonMark: // [link](/url 'title "and" title') // // Should be rendered as: //

link

- Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 477, "Inlines Links"); + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 478, "Inlines Links"); TestParser.TestSpec("[link](/url 'title \"and\" title')", "

link

", ""); } } @@ -12804,9 +12834,9 @@ namespace Markdig.Tests public partial class TestInlinesLinks { [Test] - public void Example478() + public void Example479() { - // Example 478 + // Example 479 // Section: Inlines Links // // The following CommonMark: @@ -12816,7 +12846,7 @@ namespace Markdig.Tests // Should be rendered as: //

link

- Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 478, "Inlines Links"); + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 479, "Inlines Links"); TestParser.TestSpec("[link]( /uri\n \"title\" )", "

link

", ""); } } @@ -12824,27 +12854,6 @@ namespace Markdig.Tests // following parenthesis: [TestFixture] public partial class TestInlinesLinks - { - [Test] - public void Example479() - { - // Example 479 - // Section: Inlines Links - // - // The following CommonMark: - // [link] (/uri) - // - // Should be rendered as: - //

[link] (/uri)

- - Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 479, "Inlines Links"); - TestParser.TestSpec("[link] (/uri)", "

[link] (/uri)

", ""); - } - } - // The link text may contain balanced brackets, but not unbalanced ones, - // unless they are escaped: - [TestFixture] - public partial class TestInlinesLinks { [Test] public void Example480() @@ -12853,15 +12862,17 @@ namespace Markdig.Tests // Section: Inlines Links // // The following CommonMark: - // [link [foo [bar]]](/uri) + // [link] (/uri) // // Should be rendered as: - //

link [foo [bar]]

+ //

[link] (/uri)

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 480, "Inlines Links"); - TestParser.TestSpec("[link [foo [bar]]](/uri)", "

link [foo [bar]]

", ""); + TestParser.TestSpec("[link] (/uri)", "

[link] (/uri)

", ""); } } + // The link text may contain balanced brackets, but not unbalanced ones, + // unless they are escaped: [TestFixture] public partial class TestInlinesLinks { @@ -12872,13 +12883,13 @@ namespace Markdig.Tests // Section: Inlines Links // // The following CommonMark: - // [link] bar](/uri) + // [link [foo [bar]]](/uri) // // Should be rendered as: - //

[link] bar](/uri)

+ //

link [foo [bar]]

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 481, "Inlines Links"); - TestParser.TestSpec("[link] bar](/uri)", "

[link] bar](/uri)

", ""); + TestParser.TestSpec("[link [foo [bar]]](/uri)", "

link [foo [bar]]

", ""); } } [TestFixture] @@ -12891,13 +12902,13 @@ namespace Markdig.Tests // Section: Inlines Links // // The following CommonMark: - // [link [bar](/uri) + // [link] bar](/uri) // // Should be rendered as: - //

[link bar

+ //

[link] bar](/uri)

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 482, "Inlines Links"); - TestParser.TestSpec("[link [bar](/uri)", "

[link bar

", ""); + TestParser.TestSpec("[link] bar](/uri)", "

[link] bar](/uri)

", ""); } } [TestFixture] @@ -12910,16 +12921,15 @@ namespace Markdig.Tests // Section: Inlines Links // // The following CommonMark: - // [link \[bar](/uri) + // [link [bar](/uri) // // Should be rendered as: - //

link [bar

+ //

[link bar

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 483, "Inlines Links"); - TestParser.TestSpec("[link \\[bar](/uri)", "

link [bar

", ""); + TestParser.TestSpec("[link [bar](/uri)", "

[link bar

", ""); } } - // The link text may contain inline content: [TestFixture] public partial class TestInlinesLinks { @@ -12930,15 +12940,16 @@ namespace Markdig.Tests // Section: Inlines Links // // The following CommonMark: - // [link *foo **bar** `#`*](/uri) + // [link \[bar](/uri) // // Should be rendered as: - //

link foo bar #

+ //

link [bar

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 484, "Inlines Links"); - TestParser.TestSpec("[link *foo **bar** `#`*](/uri)", "

link foo bar #

", ""); + TestParser.TestSpec("[link \\[bar](/uri)", "

link [bar

", ""); } } + // The link text may contain inline content: [TestFixture] public partial class TestInlinesLinks { @@ -12949,16 +12960,15 @@ namespace Markdig.Tests // Section: Inlines Links // // The following CommonMark: - // [![moon](moon.jpg)](/uri) + // [link *foo **bar** `#`*](/uri) // // Should be rendered as: - //

moon

+ //

link foo bar #

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 485, "Inlines Links"); - TestParser.TestSpec("[![moon](moon.jpg)](/uri)", "

\"moon\"

", ""); + TestParser.TestSpec("[link *foo **bar** `#`*](/uri)", "

link foo bar #

", ""); } } - // However, links may not contain other links, at any level of nesting. [TestFixture] public partial class TestInlinesLinks { @@ -12969,15 +12979,16 @@ namespace Markdig.Tests // Section: Inlines Links // // The following CommonMark: - // [foo [bar](/uri)](/uri) + // [![moon](moon.jpg)](/uri) // // Should be rendered as: - //

[foo bar](/uri)

+ //

moon

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 486, "Inlines Links"); - TestParser.TestSpec("[foo [bar](/uri)](/uri)", "

[foo bar](/uri)

", ""); + TestParser.TestSpec("[![moon](moon.jpg)](/uri)", "

\"moon\"

", ""); } } + // However, links may not contain other links, at any level of nesting. [TestFixture] public partial class TestInlinesLinks { @@ -12988,13 +12999,13 @@ namespace Markdig.Tests // Section: Inlines Links // // The following CommonMark: - // [foo *[bar [baz](/uri)](/uri)*](/uri) + // [foo [bar](/uri)](/uri) // // Should be rendered as: - //

[foo [bar baz](/uri)](/uri)

+ //

[foo bar](/uri)

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 487, "Inlines Links"); - TestParser.TestSpec("[foo *[bar [baz](/uri)](/uri)*](/uri)", "

[foo [bar baz](/uri)](/uri)

", ""); + TestParser.TestSpec("[foo [bar](/uri)](/uri)", "

[foo bar](/uri)

", ""); } } [TestFixture] @@ -13007,17 +13018,15 @@ namespace Markdig.Tests // Section: Inlines Links // // The following CommonMark: - // ![[[foo](uri1)](uri2)](uri3) + // [foo *[bar [baz](/uri)](/uri)*](/uri) // // Should be rendered as: - //

[foo](uri2)

+ //

[foo [bar baz](/uri)](/uri)

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 488, "Inlines Links"); - TestParser.TestSpec("![[[foo](uri1)](uri2)](uri3)", "

\"[foo](uri2)\"

", ""); + TestParser.TestSpec("[foo *[bar [baz](/uri)](/uri)*](/uri)", "

[foo [bar baz](/uri)](/uri)

", ""); } } - // These cases illustrate the precedence of link text grouping over - // emphasis grouping: [TestFixture] public partial class TestInlinesLinks { @@ -13028,15 +13037,17 @@ namespace Markdig.Tests // Section: Inlines Links // // The following CommonMark: - // *[foo*](/uri) + // ![[[foo](uri1)](uri2)](uri3) // // Should be rendered as: - //

*foo*

+ //

[foo](uri2)

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 489, "Inlines Links"); - TestParser.TestSpec("*[foo*](/uri)", "

*foo*

", ""); + TestParser.TestSpec("![[[foo](uri1)](uri2)](uri3)", "

\"[foo](uri2)\"

", ""); } } + // These cases illustrate the precedence of link text grouping over + // emphasis grouping: [TestFixture] public partial class TestInlinesLinks { @@ -13047,17 +13058,15 @@ namespace Markdig.Tests // Section: Inlines Links // // The following CommonMark: - // [foo *bar](baz*) + // *[foo*](/uri) // // Should be rendered as: - //

foo *bar

+ //

*foo*

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 490, "Inlines Links"); - TestParser.TestSpec("[foo *bar](baz*)", "

foo *bar

", ""); + TestParser.TestSpec("*[foo*](/uri)", "

*foo*

", ""); } } - // Note that brackets that *aren't* part of links do not take - // precedence: [TestFixture] public partial class TestInlinesLinks { @@ -13068,17 +13077,17 @@ namespace Markdig.Tests // Section: Inlines Links // // The following CommonMark: - // *foo [bar* baz] + // [foo *bar](baz*) // // Should be rendered as: - //

foo [bar baz]

+ //

foo *bar

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 491, "Inlines Links"); - TestParser.TestSpec("*foo [bar* baz]", "

foo [bar baz]

", ""); + TestParser.TestSpec("[foo *bar](baz*)", "

foo *bar

", ""); } } - // These cases illustrate the precedence of HTML tags, code spans, - // and autolinks over link grouping: + // Note that brackets that *aren't* part of links do not take + // precedence: [TestFixture] public partial class TestInlinesLinks { @@ -13089,15 +13098,17 @@ namespace Markdig.Tests // Section: Inlines Links // // The following CommonMark: - // [foo + // *foo [bar* baz] // // Should be rendered as: - //

[foo

+ //

foo [bar baz]

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 492, "Inlines Links"); - TestParser.TestSpec("[foo ", "

[foo

", ""); + TestParser.TestSpec("*foo [bar* baz]", "

foo [bar baz]

", ""); } } + // These cases illustrate the precedence of HTML tags, code spans, + // and autolinks over link grouping: [TestFixture] public partial class TestInlinesLinks { @@ -13108,13 +13119,13 @@ namespace Markdig.Tests // Section: Inlines Links // // The following CommonMark: - // [foo`](/uri)` + // [foo // // Should be rendered as: - //

[foo](/uri)

+ //

[foo

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 493, "Inlines Links"); - TestParser.TestSpec("[foo`](/uri)`", "

[foo](/uri)

", ""); + TestParser.TestSpec("[foo ", "

[foo

", ""); } } [TestFixture] @@ -13127,12 +13138,31 @@ namespace Markdig.Tests // Section: Inlines Links // // The following CommonMark: + // [foo`](/uri)` + // + // Should be rendered as: + //

[foo](/uri)

+ + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 494, "Inlines Links"); + TestParser.TestSpec("[foo`](/uri)`", "

[foo](/uri)

", ""); + } + } + [TestFixture] + public partial class TestInlinesLinks + { + [Test] + public void Example495() + { + // Example 495 + // Section: Inlines Links + // + // The following CommonMark: // [foo // // Should be rendered as: //

[foohttp://example.com/?search=](uri)

- Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 494, "Inlines Links"); + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 495, "Inlines Links"); TestParser.TestSpec("[foo", "

[foohttp://example.com/?search=](uri)

", ""); } } @@ -13167,9 +13197,9 @@ namespace Markdig.Tests public partial class TestInlinesLinks { [Test] - public void Example495() + public void Example496() { - // Example 495 + // Example 496 // Section: Inlines Links // // The following CommonMark: @@ -13180,7 +13210,7 @@ namespace Markdig.Tests // Should be rendered as: //

foo

- Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 495, "Inlines Links"); + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 496, "Inlines Links"); TestParser.TestSpec("[foo][bar]\n\n[bar]: /url \"title\"", "

foo

", ""); } } @@ -13193,9 +13223,9 @@ namespace Markdig.Tests public partial class TestInlinesLinks { [Test] - public void Example496() + public void Example497() { - // Example 496 + // Example 497 // Section: Inlines Links // // The following CommonMark: @@ -13206,34 +13236,12 @@ namespace Markdig.Tests // Should be rendered as: //

link [foo [bar]]

- Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 496, "Inlines Links"); + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 497, "Inlines Links"); TestParser.TestSpec("[link [foo [bar]]][ref]\n\n[ref]: /uri", "

link [foo [bar]]

", ""); } } [TestFixture] public partial class TestInlinesLinks - { - [Test] - public void Example497() - { - // Example 497 - // Section: Inlines Links - // - // The following CommonMark: - // [link \[bar][ref] - // - // [ref]: /uri - // - // Should be rendered as: - //

link [bar

- - Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 497, "Inlines Links"); - TestParser.TestSpec("[link \\[bar][ref]\n\n[ref]: /uri", "

link [bar

", ""); - } - } - // The link text may contain inline content: - [TestFixture] - public partial class TestInlinesLinks { [Test] public void Example498() @@ -13242,17 +13250,18 @@ namespace Markdig.Tests // Section: Inlines Links // // The following CommonMark: - // [link *foo **bar** `#`*][ref] + // [link \[bar][ref] // // [ref]: /uri // // Should be rendered as: - //

link foo bar #

+ //

link [bar

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 498, "Inlines Links"); - TestParser.TestSpec("[link *foo **bar** `#`*][ref]\n\n[ref]: /uri", "

link foo bar #

", ""); + TestParser.TestSpec("[link \\[bar][ref]\n\n[ref]: /uri", "

link [bar

", ""); } } + // The link text may contain inline content: [TestFixture] public partial class TestInlinesLinks { @@ -13263,18 +13272,17 @@ namespace Markdig.Tests // Section: Inlines Links // // The following CommonMark: - // [![moon](moon.jpg)][ref] + // [link *foo **bar** `#`*][ref] // // [ref]: /uri // // Should be rendered as: - //

moon

+ //

link foo bar #

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 499, "Inlines Links"); - TestParser.TestSpec("[![moon](moon.jpg)][ref]\n\n[ref]: /uri", "

\"moon\"

", ""); + TestParser.TestSpec("[link *foo **bar** `#`*][ref]\n\n[ref]: /uri", "

link foo bar #

", ""); } } - // However, links may not contain other links, at any level of nesting. [TestFixture] public partial class TestInlinesLinks { @@ -13285,17 +13293,18 @@ namespace Markdig.Tests // Section: Inlines Links // // The following CommonMark: - // [foo [bar](/uri)][ref] + // [![moon](moon.jpg)][ref] // // [ref]: /uri // // Should be rendered as: - //

[foo bar]ref

+ //

moon

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 500, "Inlines Links"); - TestParser.TestSpec("[foo [bar](/uri)][ref]\n\n[ref]: /uri", "

[foo bar]ref

", ""); + TestParser.TestSpec("[![moon](moon.jpg)][ref]\n\n[ref]: /uri", "

\"moon\"

", ""); } } + // However, links may not contain other links, at any level of nesting. [TestFixture] public partial class TestInlinesLinks { @@ -13306,6 +13315,27 @@ namespace Markdig.Tests // Section: Inlines Links // // The following CommonMark: + // [foo [bar](/uri)][ref] + // + // [ref]: /uri + // + // Should be rendered as: + //

[foo bar]ref

+ + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 501, "Inlines Links"); + TestParser.TestSpec("[foo [bar](/uri)][ref]\n\n[ref]: /uri", "

[foo bar]ref

", ""); + } + } + [TestFixture] + public partial class TestInlinesLinks + { + [Test] + public void Example502() + { + // Example 502 + // Section: Inlines Links + // + // The following CommonMark: // [foo *bar [baz][ref]*][ref] // // [ref]: /uri @@ -13313,7 +13343,7 @@ namespace Markdig.Tests // Should be rendered as: //

[foo bar baz]ref

- Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 501, "Inlines Links"); + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 502, "Inlines Links"); TestParser.TestSpec("[foo *bar [baz][ref]*][ref]\n\n[ref]: /uri", "

[foo bar baz]ref

", ""); } } @@ -13326,9 +13356,9 @@ namespace Markdig.Tests public partial class TestInlinesLinks { [Test] - public void Example502() + public void Example503() { - // Example 502 + // Example 503 // Section: Inlines Links // // The following CommonMark: @@ -13339,35 +13369,12 @@ namespace Markdig.Tests // Should be rendered as: //

*foo*

- Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 502, "Inlines Links"); + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 503, "Inlines Links"); TestParser.TestSpec("*[foo*][ref]\n\n[ref]: /uri", "

*foo*

", ""); } } [TestFixture] public partial class TestInlinesLinks - { - [Test] - public void Example503() - { - // Example 503 - // Section: Inlines Links - // - // The following CommonMark: - // [foo *bar][ref] - // - // [ref]: /uri - // - // Should be rendered as: - //

foo *bar

- - Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 503, "Inlines Links"); - TestParser.TestSpec("[foo *bar][ref]\n\n[ref]: /uri", "

foo *bar

", ""); - } - } - // These cases illustrate the precedence of HTML tags, code spans, - // and autolinks over link grouping: - [TestFixture] - public partial class TestInlinesLinks { [Test] public void Example504() @@ -13376,17 +13383,19 @@ namespace Markdig.Tests // Section: Inlines Links // // The following CommonMark: - // [foo + // [foo *bar][ref] // // [ref]: /uri // // Should be rendered as: - //

[foo

+ //

foo *bar

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 504, "Inlines Links"); - TestParser.TestSpec("[foo \n\n[ref]: /uri", "

[foo

", ""); + TestParser.TestSpec("[foo *bar][ref]\n\n[ref]: /uri", "

foo *bar

", ""); } } + // These cases illustrate the precedence of HTML tags, code spans, + // and autolinks over link grouping: [TestFixture] public partial class TestInlinesLinks { @@ -13397,15 +13406,15 @@ namespace Markdig.Tests // Section: Inlines Links // // The following CommonMark: - // [foo`][ref]` + // [foo // // [ref]: /uri // // Should be rendered as: - //

[foo][ref]

+ //

[foo

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 505, "Inlines Links"); - TestParser.TestSpec("[foo`][ref]`\n\n[ref]: /uri", "

[foo][ref]

", ""); + TestParser.TestSpec("[foo \n\n[ref]: /uri", "

[foo

", ""); } } [TestFixture] @@ -13418,18 +13427,17 @@ namespace Markdig.Tests // Section: Inlines Links // // The following CommonMark: - // [foo + // [foo`][ref]` // // [ref]: /uri // // Should be rendered as: - //

[foohttp://example.com/?search=][ref]

+ //

[foo][ref]

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 506, "Inlines Links"); - TestParser.TestSpec("[foo\n\n[ref]: /uri", "

[foohttp://example.com/?search=][ref]

", ""); + TestParser.TestSpec("[foo`][ref]`\n\n[ref]: /uri", "

[foo][ref]

", ""); } } - // Matching is case-insensitive: [TestFixture] public partial class TestInlinesLinks { @@ -13440,18 +13448,18 @@ namespace Markdig.Tests // Section: Inlines Links // // The following CommonMark: - // [foo][BaR] + // [foo // - // [bar]: /url "title" + // [ref]: /uri // // Should be rendered as: - //

foo

+ //

[foohttp://example.com/?search=][ref]

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 507, "Inlines Links"); - TestParser.TestSpec("[foo][BaR]\n\n[bar]: /url \"title\"", "

foo

", ""); + TestParser.TestSpec("[foo\n\n[ref]: /uri", "

[foohttp://example.com/?search=][ref]

", ""); } } - // Unicode case fold is used: + // Matching is case-insensitive: [TestFixture] public partial class TestInlinesLinks { @@ -13462,6 +13470,28 @@ namespace Markdig.Tests // Section: Inlines Links // // The following CommonMark: + // [foo][BaR] + // + // [bar]: /url "title" + // + // Should be rendered as: + //

foo

+ + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 508, "Inlines Links"); + TestParser.TestSpec("[foo][BaR]\n\n[bar]: /url \"title\"", "

foo

", ""); + } + } + // Unicode case fold is used: + [TestFixture] + public partial class TestInlinesLinks + { + [Test] + public void Example509() + { + // Example 509 + // Section: Inlines Links + // + // The following CommonMark: // [Толпой][Толпой] is a Russian word. // // [ТОЛПОЙ]: /url @@ -13469,7 +13499,7 @@ namespace Markdig.Tests // Should be rendered as: //

Толпой is a Russian word.

- Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 508, "Inlines Links"); + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 509, "Inlines Links"); TestParser.TestSpec("[Толпой][Толпой] is a Russian word.\n\n[ТОЛПОЙ]: /url", "

Толпой is a Russian word.

", ""); } } @@ -13479,9 +13509,9 @@ namespace Markdig.Tests public partial class TestInlinesLinks { [Test] - public void Example509() + public void Example510() { - // Example 509 + // Example 510 // Section: Inlines Links // // The following CommonMark: @@ -13493,7 +13523,7 @@ namespace Markdig.Tests // Should be rendered as: //

Baz

- Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 509, "Inlines Links"); + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 510, "Inlines Links"); TestParser.TestSpec("[Foo\n bar]: /url\n\n[Baz][Foo bar]", "

Baz

", ""); } } @@ -13503,9 +13533,9 @@ namespace Markdig.Tests public partial class TestInlinesLinks { [Test] - public void Example510() + public void Example511() { - // Example 510 + // Example 511 // Section: Inlines Links // // The following CommonMark: @@ -13516,7 +13546,7 @@ namespace Markdig.Tests // Should be rendered as: //

[foo] bar

- Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 510, "Inlines Links"); + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 511, "Inlines Links"); TestParser.TestSpec("[foo] [bar]\n\n[bar]: /url \"title\"", "

[foo] bar

", ""); } } @@ -13524,9 +13554,9 @@ namespace Markdig.Tests public partial class TestInlinesLinks { [Test] - public void Example511() + public void Example512() { - // Example 511 + // Example 512 // Section: Inlines Links // // The following CommonMark: @@ -13539,7 +13569,7 @@ namespace Markdig.Tests //

[foo] // bar

- Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 511, "Inlines Links"); + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 512, "Inlines Links"); TestParser.TestSpec("[foo]\n[bar]\n\n[bar]: /url \"title\"", "

[foo]\nbar

", ""); } } @@ -13576,9 +13606,9 @@ namespace Markdig.Tests public partial class TestInlinesLinks { [Test] - public void Example512() + public void Example513() { - // Example 512 + // Example 513 // Section: Inlines Links // // The following CommonMark: @@ -13591,7 +13621,7 @@ namespace Markdig.Tests // Should be rendered as: //

bar

- Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 512, "Inlines Links"); + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 513, "Inlines Links"); TestParser.TestSpec("[foo]: /url1\n\n[foo]: /url2\n\n[bar][foo]", "

bar

", ""); } } @@ -13602,9 +13632,9 @@ namespace Markdig.Tests public partial class TestInlinesLinks { [Test] - public void Example513() + public void Example514() { - // Example 513 + // Example 514 // Section: Inlines Links // // The following CommonMark: @@ -13615,7 +13645,7 @@ namespace Markdig.Tests // Should be rendered as: //

[bar][foo!]

- Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 513, "Inlines Links"); + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 514, "Inlines Links"); TestParser.TestSpec("[bar][foo\\!]\n\n[foo!]: /url", "

[bar][foo!]

", ""); } } @@ -13625,9 +13655,9 @@ namespace Markdig.Tests public partial class TestInlinesLinks { [Test] - public void Example514() + public void Example515() { - // Example 514 + // Example 515 // Section: Inlines Links // // The following CommonMark: @@ -13639,30 +13669,8 @@ namespace Markdig.Tests //

[foo][ref[]

//

[ref[]: /uri

- Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 514, "Inlines Links"); - TestParser.TestSpec("[foo][ref[]\n\n[ref[]: /uri", "

[foo][ref[]

\n

[ref[]: /uri

", ""); - } - } - [TestFixture] - public partial class TestInlinesLinks - { - [Test] - public void Example515() - { - // Example 515 - // Section: Inlines Links - // - // The following CommonMark: - // [foo][ref[bar]] - // - // [ref[bar]]: /uri - // - // Should be rendered as: - //

[foo][ref[bar]]

- //

[ref[bar]]: /uri

- Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 515, "Inlines Links"); - TestParser.TestSpec("[foo][ref[bar]]\n\n[ref[bar]]: /uri", "

[foo][ref[bar]]

\n

[ref[bar]]: /uri

", ""); + TestParser.TestSpec("[foo][ref[]\n\n[ref[]: /uri", "

[foo][ref[]

\n

[ref[]: /uri

", ""); } } [TestFixture] @@ -13675,16 +13683,16 @@ namespace Markdig.Tests // Section: Inlines Links // // The following CommonMark: - // [[[foo]]] + // [foo][ref[bar]] // - // [[[foo]]]: /url + // [ref[bar]]: /uri // // Should be rendered as: - //

[[[foo]]]

- //

[[[foo]]]: /url

+ //

[foo][ref[bar]]

+ //

[ref[bar]]: /uri

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 516, "Inlines Links"); - TestParser.TestSpec("[[[foo]]]\n\n[[[foo]]]: /url", "

[[[foo]]]

\n

[[[foo]]]: /url

", ""); + TestParser.TestSpec("[foo][ref[bar]]\n\n[ref[bar]]: /uri", "

[foo][ref[bar]]

\n

[ref[bar]]: /uri

", ""); } } [TestFixture] @@ -13697,18 +13705,18 @@ namespace Markdig.Tests // Section: Inlines Links // // The following CommonMark: - // [foo][ref\[] + // [[[foo]]] // - // [ref\[]: /uri + // [[[foo]]]: /url // // Should be rendered as: - //

foo

+ //

[[[foo]]]

+ //

[[[foo]]]: /url

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 517, "Inlines Links"); - TestParser.TestSpec("[foo][ref\\[]\n\n[ref\\[]: /uri", "

foo

", ""); + TestParser.TestSpec("[[[foo]]]\n\n[[[foo]]]: /url", "

[[[foo]]]

\n

[[[foo]]]: /url

", ""); } } - // Note that in this example `]` is not backslash-escaped: [TestFixture] public partial class TestInlinesLinks { @@ -13719,6 +13727,28 @@ namespace Markdig.Tests // Section: Inlines Links // // The following CommonMark: + // [foo][ref\[] + // + // [ref\[]: /uri + // + // Should be rendered as: + //

foo

+ + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 518, "Inlines Links"); + TestParser.TestSpec("[foo][ref\\[]\n\n[ref\\[]: /uri", "

foo

", ""); + } + } + // Note that in this example `]` is not backslash-escaped: + [TestFixture] + public partial class TestInlinesLinks + { + [Test] + public void Example519() + { + // Example 519 + // Section: Inlines Links + // + // The following CommonMark: // [bar\\]: /uri // // [bar\\] @@ -13726,7 +13756,7 @@ namespace Markdig.Tests // Should be rendered as: //

bar\

- Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 518, "Inlines Links"); + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 519, "Inlines Links"); TestParser.TestSpec("[bar\\\\]: /uri\n\n[bar\\\\]", "

bar\\

", ""); } } @@ -13735,9 +13765,9 @@ namespace Markdig.Tests public partial class TestInlinesLinks { [Test] - public void Example519() + public void Example520() { - // Example 519 + // Example 520 // Section: Inlines Links // // The following CommonMark: @@ -13749,7 +13779,7 @@ namespace Markdig.Tests //

[]

//

[]: /uri

- Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 519, "Inlines Links"); + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 520, "Inlines Links"); TestParser.TestSpec("[]\n\n[]: /uri", "

[]

\n

[]: /uri

", ""); } } @@ -13757,9 +13787,9 @@ namespace Markdig.Tests public partial class TestInlinesLinks { [Test] - public void Example520() + public void Example521() { - // Example 520 + // Example 521 // Section: Inlines Links // // The following CommonMark: @@ -13775,7 +13805,7 @@ namespace Markdig.Tests //

[ // ]: /uri

- Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 520, "Inlines Links"); + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 521, "Inlines Links"); TestParser.TestSpec("[\n ]\n\n[\n ]: /uri", "

[\n]

\n

[\n]: /uri

", ""); } } @@ -13791,9 +13821,9 @@ namespace Markdig.Tests public partial class TestInlinesLinks { [Test] - public void Example521() + public void Example522() { - // Example 521 + // Example 522 // Section: Inlines Links // // The following CommonMark: @@ -13804,34 +13834,12 @@ namespace Markdig.Tests // Should be rendered as: //

foo

- Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 521, "Inlines Links"); + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 522, "Inlines Links"); TestParser.TestSpec("[foo][]\n\n[foo]: /url \"title\"", "

foo

", ""); } } [TestFixture] public partial class TestInlinesLinks - { - [Test] - public void Example522() - { - // Example 522 - // Section: Inlines Links - // - // The following CommonMark: - // [*foo* bar][] - // - // [*foo* bar]: /url "title" - // - // Should be rendered as: - //

foo bar

- - Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 522, "Inlines Links"); - TestParser.TestSpec("[*foo* bar][]\n\n[*foo* bar]: /url \"title\"", "

foo bar

", ""); - } - } - // The link labels are case-insensitive: - [TestFixture] - public partial class TestInlinesLinks { [Test] public void Example523() @@ -13840,6 +13848,28 @@ namespace Markdig.Tests // Section: Inlines Links // // The following CommonMark: + // [*foo* bar][] + // + // [*foo* bar]: /url "title" + // + // Should be rendered as: + //

foo bar

+ + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 523, "Inlines Links"); + TestParser.TestSpec("[*foo* bar][]\n\n[*foo* bar]: /url \"title\"", "

foo bar

", ""); + } + } + // The link labels are case-insensitive: + [TestFixture] + public partial class TestInlinesLinks + { + [Test] + public void Example524() + { + // Example 524 + // Section: Inlines Links + // + // The following CommonMark: // [Foo][] // // [foo]: /url "title" @@ -13847,7 +13877,7 @@ namespace Markdig.Tests // Should be rendered as: //

Foo

- Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 523, "Inlines Links"); + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 524, "Inlines Links"); TestParser.TestSpec("[Foo][]\n\n[foo]: /url \"title\"", "

Foo

", ""); } } @@ -13857,9 +13887,9 @@ namespace Markdig.Tests public partial class TestInlinesLinks { [Test] - public void Example524() + public void Example525() { - // Example 524 + // Example 525 // Section: Inlines Links // // The following CommonMark: @@ -13872,7 +13902,7 @@ namespace Markdig.Tests //

foo // []

- Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 524, "Inlines Links"); + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 525, "Inlines Links"); TestParser.TestSpec("[foo] \n[]\n\n[foo]: /url \"title\"", "

foo\n[]

", ""); } } @@ -13888,9 +13918,9 @@ namespace Markdig.Tests public partial class TestInlinesLinks { [Test] - public void Example525() + public void Example526() { - // Example 525 + // Example 526 // Section: Inlines Links // // The following CommonMark: @@ -13901,29 +13931,8 @@ namespace Markdig.Tests // Should be rendered as: //

foo

- Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 525, "Inlines Links"); - TestParser.TestSpec("[foo]\n\n[foo]: /url \"title\"", "

foo

", ""); - } - } - [TestFixture] - public partial class TestInlinesLinks - { - [Test] - public void Example526() - { - // Example 526 - // Section: Inlines Links - // - // The following CommonMark: - // [*foo* bar] - // - // [*foo* bar]: /url "title" - // - // Should be rendered as: - //

foo bar

- Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 526, "Inlines Links"); - TestParser.TestSpec("[*foo* bar]\n\n[*foo* bar]: /url \"title\"", "

foo bar

", ""); + TestParser.TestSpec("[foo]\n\n[foo]: /url \"title\"", "

foo

", ""); } } [TestFixture] @@ -13936,15 +13945,15 @@ namespace Markdig.Tests // Section: Inlines Links // // The following CommonMark: - // [[*foo* bar]] + // [*foo* bar] // // [*foo* bar]: /url "title" // // Should be rendered as: - //

[foo bar]

+ //

foo bar

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 527, "Inlines Links"); - TestParser.TestSpec("[[*foo* bar]]\n\n[*foo* bar]: /url \"title\"", "

[foo bar]

", ""); + TestParser.TestSpec("[*foo* bar]\n\n[*foo* bar]: /url \"title\"", "

foo bar

", ""); } } [TestFixture] @@ -13957,18 +13966,17 @@ namespace Markdig.Tests // Section: Inlines Links // // The following CommonMark: - // [[bar [foo] + // [[*foo* bar]] // - // [foo]: /url + // [*foo* bar]: /url "title" // // Should be rendered as: - //

[[bar foo

+ //

[foo bar]

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 528, "Inlines Links"); - TestParser.TestSpec("[[bar [foo]\n\n[foo]: /url", "

[[bar foo

", ""); + TestParser.TestSpec("[[*foo* bar]]\n\n[*foo* bar]: /url \"title\"", "

[foo bar]

", ""); } } - // The link labels are case-insensitive: [TestFixture] public partial class TestInlinesLinks { @@ -13979,18 +13987,18 @@ namespace Markdig.Tests // Section: Inlines Links // // The following CommonMark: - // [Foo] + // [[bar [foo] // - // [foo]: /url "title" + // [foo]: /url // // Should be rendered as: - //

Foo

+ //

[[bar foo

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 529, "Inlines Links"); - TestParser.TestSpec("[Foo]\n\n[foo]: /url \"title\"", "

Foo

", ""); + TestParser.TestSpec("[[bar [foo]\n\n[foo]: /url", "

[[bar foo

", ""); } } - // A space after the link text should be preserved: + // The link labels are case-insensitive: [TestFixture] public partial class TestInlinesLinks { @@ -14001,19 +14009,18 @@ namespace Markdig.Tests // Section: Inlines Links // // The following CommonMark: - // [foo] bar + // [Foo] // - // [foo]: /url + // [foo]: /url "title" // // Should be rendered as: - //

foo bar

+ //

Foo

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 530, "Inlines Links"); - TestParser.TestSpec("[foo] bar\n\n[foo]: /url", "

foo bar

", ""); + TestParser.TestSpec("[Foo]\n\n[foo]: /url \"title\"", "

Foo

", ""); } } - // If you just want bracketed text, you can backslash-escape the - // opening bracket to avoid links: + // A space after the link text should be preserved: [TestFixture] public partial class TestInlinesLinks { @@ -14024,19 +14031,19 @@ namespace Markdig.Tests // Section: Inlines Links // // The following CommonMark: - // \[foo] + // [foo] bar // - // [foo]: /url "title" + // [foo]: /url // // Should be rendered as: - //

[foo]

+ //

foo bar

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 531, "Inlines Links"); - TestParser.TestSpec("\\[foo]\n\n[foo]: /url \"title\"", "

[foo]

", ""); + TestParser.TestSpec("[foo] bar\n\n[foo]: /url", "

foo bar

", ""); } } - // Note that this is a link, because a link label ends with the first - // following closing bracket: + // If you just want bracketed text, you can backslash-escape the + // opening bracket to avoid links: [TestFixture] public partial class TestInlinesLinks { @@ -14047,18 +14054,19 @@ namespace Markdig.Tests // Section: Inlines Links // // The following CommonMark: - // [foo*]: /url + // \[foo] // - // *[foo*] + // [foo]: /url "title" // // Should be rendered as: - //

*foo*

+ //

[foo]

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 532, "Inlines Links"); - TestParser.TestSpec("[foo*]: /url\n\n*[foo*]", "

*foo*

", ""); + TestParser.TestSpec("\\[foo]\n\n[foo]: /url \"title\"", "

[foo]

", ""); } } - // Full references take precedence over shortcut references: + // Note that this is a link, because a link label ends with the first + // following closing bracket: [TestFixture] public partial class TestInlinesLinks { @@ -14069,6 +14077,29 @@ namespace Markdig.Tests // Section: Inlines Links // // The following CommonMark: + // [foo*]: /url + // + // *[foo*] + // + // Should be rendered as: + //

*foo*

+ + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 533, "Inlines Links"); + TestParser.TestSpec("[foo*]: /url\n\n*[foo*]", "

*foo*

", ""); + } + } + // Full and compact references take precedence over shortcut + // references: + [TestFixture] + public partial class TestInlinesLinks + { + [Test] + public void Example534() + { + // Example 534 + // Section: Inlines Links + // + // The following CommonMark: // [foo][bar] // // [foo]: /url1 @@ -14077,9 +14108,73 @@ namespace Markdig.Tests // Should be rendered as: //

foo

- Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 533, "Inlines Links"); + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 534, "Inlines Links"); TestParser.TestSpec("[foo][bar]\n\n[foo]: /url1\n[bar]: /url2", "

foo

", ""); } + } + [TestFixture] + public partial class TestInlinesLinks + { + [Test] + public void Example535() + { + // Example 535 + // Section: Inlines Links + // + // The following CommonMark: + // [foo][] + // + // [foo]: /url1 + // + // Should be rendered as: + //

foo

+ + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 535, "Inlines Links"); + TestParser.TestSpec("[foo][]\n\n[foo]: /url1", "

foo

", ""); + } + } + // Inline links also take precedence: + [TestFixture] + public partial class TestInlinesLinks + { + [Test] + public void Example536() + { + // Example 536 + // Section: Inlines Links + // + // The following CommonMark: + // [foo]() + // + // [foo]: /url1 + // + // Should be rendered as: + //

foo

+ + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 536, "Inlines Links"); + TestParser.TestSpec("[foo]()\n\n[foo]: /url1", "

foo

", ""); + } + } + [TestFixture] + public partial class TestInlinesLinks + { + [Test] + public void Example537() + { + // Example 537 + // Section: Inlines Links + // + // The following CommonMark: + // [foo](not a link) + // + // [foo]: /url1 + // + // Should be rendered as: + //

foo(not a link)

+ + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 537, "Inlines Links"); + TestParser.TestSpec("[foo](not a link)\n\n[foo]: /url1", "

foo(not a link)

", ""); + } } // In the following case `[bar][baz]` is parsed as a reference, // `[foo]` as normal text: @@ -14087,9 +14182,9 @@ namespace Markdig.Tests public partial class TestInlinesLinks { [Test] - public void Example534() + public void Example538() { - // Example 534 + // Example 538 // Section: Inlines Links // // The following CommonMark: @@ -14100,7 +14195,7 @@ namespace Markdig.Tests // Should be rendered as: //

[foo]bar

- Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 534, "Inlines Links"); + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 538, "Inlines Links"); TestParser.TestSpec("[foo][bar][baz]\n\n[baz]: /url", "

[foo]bar

", ""); } } @@ -14110,9 +14205,9 @@ namespace Markdig.Tests public partial class TestInlinesLinks { [Test] - public void Example535() + public void Example539() { - // Example 535 + // Example 539 // Section: Inlines Links // // The following CommonMark: @@ -14124,7 +14219,7 @@ namespace Markdig.Tests // Should be rendered as: //

foobaz

- Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 535, "Inlines Links"); + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 539, "Inlines Links"); TestParser.TestSpec("[foo][bar][baz]\n\n[baz]: /url1\n[bar]: /url2", "

foobaz

", ""); } } @@ -14134,9 +14229,9 @@ namespace Markdig.Tests public partial class TestInlinesLinks { [Test] - public void Example536() + public void Example540() { - // Example 536 + // Example 540 // Section: Inlines Links // // The following CommonMark: @@ -14148,7 +14243,7 @@ namespace Markdig.Tests // Should be rendered as: //

[foo]bar

- Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 536, "Inlines Links"); + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 540, "Inlines Links"); TestParser.TestSpec("[foo][bar][baz]\n\n[baz]: /url1\n[foo]: /url2", "

[foo]bar

", ""); } } @@ -14167,9 +14262,9 @@ namespace Markdig.Tests public partial class TestInlinesImages { [Test] - public void Example537() + public void Example541() { - // Example 537 + // Example 541 // Section: Inlines Images // // The following CommonMark: @@ -14178,7 +14273,7 @@ namespace Markdig.Tests // Should be rendered as: //

foo

- Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 537, "Inlines Images"); + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 541, "Inlines Images"); TestParser.TestSpec("![foo](/url \"title\")", "

\"foo\"

", ""); } } @@ -14186,9 +14281,9 @@ namespace Markdig.Tests public partial class TestInlinesImages { [Test] - public void Example538() + public void Example542() { - // Example 538 + // Example 542 // Section: Inlines Images // // The following CommonMark: @@ -14199,7 +14294,7 @@ namespace Markdig.Tests // Should be rendered as: //

foo bar

- Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 538, "Inlines Images"); + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 542, "Inlines Images"); TestParser.TestSpec("![foo *bar*]\n\n[foo *bar*]: train.jpg \"train & tracks\"", "

\"foo

", ""); } } @@ -14207,9 +14302,9 @@ namespace Markdig.Tests public partial class TestInlinesImages { [Test] - public void Example539() + public void Example543() { - // Example 539 + // Example 543 // Section: Inlines Images // // The following CommonMark: @@ -14218,7 +14313,7 @@ namespace Markdig.Tests // Should be rendered as: //

foo bar

- Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 539, "Inlines Images"); + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 543, "Inlines Images"); TestParser.TestSpec("![foo ![bar](/url)](/url2)", "

\"foo

", ""); } } @@ -14226,9 +14321,9 @@ namespace Markdig.Tests public partial class TestInlinesImages { [Test] - public void Example540() + public void Example544() { - // Example 540 + // Example 544 // Section: Inlines Images // // The following CommonMark: @@ -14237,7 +14332,7 @@ namespace Markdig.Tests // Should be rendered as: //

foo bar

- Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 540, "Inlines Images"); + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 544, "Inlines Images"); TestParser.TestSpec("![foo [bar](/url)](/url2)", "

\"foo

", ""); } } @@ -14251,9 +14346,9 @@ namespace Markdig.Tests public partial class TestInlinesImages { [Test] - public void Example541() + public void Example545() { - // Example 541 + // Example 545 // Section: Inlines Images // // The following CommonMark: @@ -14264,86 +14359,8 @@ namespace Markdig.Tests // Should be rendered as: //

foo bar

- Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 541, "Inlines Images"); - TestParser.TestSpec("![foo *bar*][]\n\n[foo *bar*]: train.jpg \"train & tracks\"", "

\"foo

", ""); - } - } - [TestFixture] - public partial class TestInlinesImages - { - [Test] - public void Example542() - { - // Example 542 - // Section: Inlines Images - // - // The following CommonMark: - // ![foo *bar*][foobar] - // - // [FOOBAR]: train.jpg "train & tracks" - // - // Should be rendered as: - //

foo bar

- - Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 542, "Inlines Images"); - TestParser.TestSpec("![foo *bar*][foobar]\n\n[FOOBAR]: train.jpg \"train & tracks\"", "

\"foo

", ""); - } - } - [TestFixture] - public partial class TestInlinesImages - { - [Test] - public void Example543() - { - // Example 543 - // Section: Inlines Images - // - // The following CommonMark: - // ![foo](train.jpg) - // - // Should be rendered as: - //

foo

- - Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 543, "Inlines Images"); - TestParser.TestSpec("![foo](train.jpg)", "

\"foo\"

", ""); - } - } - [TestFixture] - public partial class TestInlinesImages - { - [Test] - public void Example544() - { - // Example 544 - // Section: Inlines Images - // - // The following CommonMark: - // My ![foo bar](/path/to/train.jpg "title" ) - // - // Should be rendered as: - //

My foo bar

- - Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 544, "Inlines Images"); - TestParser.TestSpec("My ![foo bar](/path/to/train.jpg \"title\" )", "

My \"foo

", ""); - } - } - [TestFixture] - public partial class TestInlinesImages - { - [Test] - public void Example545() - { - // Example 545 - // Section: Inlines Images - // - // The following CommonMark: - // ![foo]() - // - // Should be rendered as: - //

foo

- Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 545, "Inlines Images"); - TestParser.TestSpec("![foo]()", "

\"foo\"

", ""); + TestParser.TestSpec("![foo *bar*][]\n\n[foo *bar*]: train.jpg \"train & tracks\"", "

\"foo

", ""); } } [TestFixture] @@ -14356,16 +14373,17 @@ namespace Markdig.Tests // Section: Inlines Images // // The following CommonMark: - // ![](/url) + // ![foo *bar*][foobar] + // + // [FOOBAR]: train.jpg "train & tracks" // // Should be rendered as: - //

+ //

foo bar

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 546, "Inlines Images"); - TestParser.TestSpec("![](/url)", "

\"\"

", ""); + TestParser.TestSpec("![foo *bar*][foobar]\n\n[FOOBAR]: train.jpg \"train & tracks\"", "

\"foo

", ""); } } - // Reference-style: [TestFixture] public partial class TestInlinesImages { @@ -14376,15 +14394,13 @@ namespace Markdig.Tests // Section: Inlines Images // // The following CommonMark: - // ![foo][bar] - // - // [bar]: /url + // ![foo](train.jpg) // // Should be rendered as: - //

foo

+ //

foo

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 547, "Inlines Images"); - TestParser.TestSpec("![foo][bar]\n\n[bar]: /url", "

\"foo\"

", ""); + TestParser.TestSpec("![foo](train.jpg)", "

\"foo\"

", ""); } } [TestFixture] @@ -14397,18 +14413,15 @@ namespace Markdig.Tests // Section: Inlines Images // // The following CommonMark: - // ![foo][bar] - // - // [BAR]: /url + // My ![foo bar](/path/to/train.jpg "title" ) // // Should be rendered as: - //

foo

+ //

My foo bar

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 548, "Inlines Images"); - TestParser.TestSpec("![foo][bar]\n\n[BAR]: /url", "

\"foo\"

", ""); + TestParser.TestSpec("My ![foo bar](/path/to/train.jpg \"title\" )", "

My \"foo

", ""); } } - // Collapsed: [TestFixture] public partial class TestInlinesImages { @@ -14419,15 +14432,13 @@ namespace Markdig.Tests // Section: Inlines Images // // The following CommonMark: - // ![foo][] - // - // [foo]: /url "title" + // ![foo]() // // Should be rendered as: - //

foo

+ //

foo

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 549, "Inlines Images"); - TestParser.TestSpec("![foo][]\n\n[foo]: /url \"title\"", "

\"foo\"

", ""); + TestParser.TestSpec("![foo]()", "

\"foo\"

", ""); } } [TestFixture] @@ -14440,18 +14451,16 @@ namespace Markdig.Tests // Section: Inlines Images // // The following CommonMark: - // ![*foo* bar][] - // - // [*foo* bar]: /url "title" + // ![](/url) // // Should be rendered as: - //

foo bar

+ //

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 550, "Inlines Images"); - TestParser.TestSpec("![*foo* bar][]\n\n[*foo* bar]: /url \"title\"", "

\"foo

", ""); + TestParser.TestSpec("![](/url)", "

\"\"

", ""); } } - // The labels are case-insensitive: + // Reference-style: [TestFixture] public partial class TestInlinesImages { @@ -14462,19 +14471,17 @@ namespace Markdig.Tests // Section: Inlines Images // // The following CommonMark: - // ![Foo][] + // ![foo][bar] // - // [foo]: /url "title" + // [bar]: /url // // Should be rendered as: - //

Foo

+ //

foo

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 551, "Inlines Images"); - TestParser.TestSpec("![Foo][]\n\n[foo]: /url \"title\"", "

\"Foo\"

", ""); + TestParser.TestSpec("![foo][bar]\n\n[bar]: /url", "

\"foo\"

", ""); } } - // As with reference links, [whitespace] is not allowed - // between the two sets of brackets: [TestFixture] public partial class TestInlinesImages { @@ -14485,20 +14492,18 @@ namespace Markdig.Tests // Section: Inlines Images // // The following CommonMark: - // ![foo] - // [] + // ![foo][bar] // - // [foo]: /url "title" + // [BAR]: /url // // Should be rendered as: - //

foo - // []

+ //

foo

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 552, "Inlines Images"); - TestParser.TestSpec("![foo] \n[]\n\n[foo]: /url \"title\"", "

\"foo\"\n[]

", ""); + TestParser.TestSpec("![foo][bar]\n\n[BAR]: /url", "

\"foo\"

", ""); } } - // Shortcut: + // Collapsed: [TestFixture] public partial class TestInlinesImages { @@ -14509,7 +14514,7 @@ namespace Markdig.Tests // Section: Inlines Images // // The following CommonMark: - // ![foo] + // ![foo][] // // [foo]: /url "title" // @@ -14517,7 +14522,7 @@ namespace Markdig.Tests //

foo

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 553, "Inlines Images"); - TestParser.TestSpec("![foo]\n\n[foo]: /url \"title\"", "

\"foo\"

", ""); + TestParser.TestSpec("![foo][]\n\n[foo]: /url \"title\"", "

\"foo\"

", ""); } } [TestFixture] @@ -14530,7 +14535,7 @@ namespace Markdig.Tests // Section: Inlines Images // // The following CommonMark: - // ![*foo* bar] + // ![*foo* bar][] // // [*foo* bar]: /url "title" // @@ -14538,6 +14543,96 @@ namespace Markdig.Tests //

foo bar

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 554, "Inlines Images"); + TestParser.TestSpec("![*foo* bar][]\n\n[*foo* bar]: /url \"title\"", "

\"foo

", ""); + } + } + // The labels are case-insensitive: + [TestFixture] + public partial class TestInlinesImages + { + [Test] + public void Example555() + { + // Example 555 + // Section: Inlines Images + // + // The following CommonMark: + // ![Foo][] + // + // [foo]: /url "title" + // + // Should be rendered as: + //

Foo

+ + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 555, "Inlines Images"); + TestParser.TestSpec("![Foo][]\n\n[foo]: /url \"title\"", "

\"Foo\"

", ""); + } + } + // As with reference links, [whitespace] is not allowed + // between the two sets of brackets: + [TestFixture] + public partial class TestInlinesImages + { + [Test] + public void Example556() + { + // Example 556 + // Section: Inlines Images + // + // The following CommonMark: + // ![foo] + // [] + // + // [foo]: /url "title" + // + // Should be rendered as: + //

foo + // []

+ + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 556, "Inlines Images"); + TestParser.TestSpec("![foo] \n[]\n\n[foo]: /url \"title\"", "

\"foo\"\n[]

", ""); + } + } + // Shortcut: + [TestFixture] + public partial class TestInlinesImages + { + [Test] + public void Example557() + { + // Example 557 + // Section: Inlines Images + // + // The following CommonMark: + // ![foo] + // + // [foo]: /url "title" + // + // Should be rendered as: + //

foo

+ + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 557, "Inlines Images"); + TestParser.TestSpec("![foo]\n\n[foo]: /url \"title\"", "

\"foo\"

", ""); + } + } + [TestFixture] + public partial class TestInlinesImages + { + [Test] + public void Example558() + { + // Example 558 + // Section: Inlines Images + // + // The following CommonMark: + // ![*foo* bar] + // + // [*foo* bar]: /url "title" + // + // Should be rendered as: + //

foo bar

+ + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 558, "Inlines Images"); TestParser.TestSpec("![*foo* bar]\n\n[*foo* bar]: /url \"title\"", "

\"foo

", ""); } } @@ -14546,9 +14641,9 @@ namespace Markdig.Tests public partial class TestInlinesImages { [Test] - public void Example555() + public void Example559() { - // Example 555 + // Example 559 // Section: Inlines Images // // The following CommonMark: @@ -14560,7 +14655,7 @@ namespace Markdig.Tests //

![[foo]]

//

[[foo]]: /url "title"

- Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 555, "Inlines Images"); + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 559, "Inlines Images"); TestParser.TestSpec("![[foo]]\n\n[[foo]]: /url \"title\"", "

![[foo]]

\n

[[foo]]: /url "title"

", ""); } } @@ -14569,9 +14664,9 @@ namespace Markdig.Tests public partial class TestInlinesImages { [Test] - public void Example556() + public void Example560() { - // Example 556 + // Example 560 // Section: Inlines Images // // The following CommonMark: @@ -14582,7 +14677,7 @@ namespace Markdig.Tests // Should be rendered as: //

Foo

- Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 556, "Inlines Images"); + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 560, "Inlines Images"); TestParser.TestSpec("![Foo]\n\n[foo]: /url \"title\"", "

\"Foo\"

", ""); } } @@ -14592,9 +14687,9 @@ namespace Markdig.Tests public partial class TestInlinesImages { [Test] - public void Example557() + public void Example561() { - // Example 557 + // Example 561 // Section: Inlines Images // // The following CommonMark: @@ -14605,7 +14700,7 @@ namespace Markdig.Tests // Should be rendered as: //

![foo]

- Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 557, "Inlines Images"); + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 561, "Inlines Images"); TestParser.TestSpec("\\!\\[foo]\n\n[foo]: /url \"title\"", "

![foo]

", ""); } } @@ -14615,9 +14710,9 @@ namespace Markdig.Tests public partial class TestInlinesImages { [Test] - public void Example558() + public void Example562() { - // Example 558 + // Example 562 // Section: Inlines Images // // The following CommonMark: @@ -14628,7 +14723,7 @@ namespace Markdig.Tests // Should be rendered as: //

!foo

- Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 558, "Inlines Images"); + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 562, "Inlines Images"); TestParser.TestSpec("\\![foo]\n\n[foo]: /url \"title\"", "

!foo

", ""); } } @@ -14659,9 +14754,9 @@ namespace Markdig.Tests public partial class TestInlinesAutolinks { [Test] - public void Example559() + public void Example563() { - // Example 559 + // Example 563 // Section: Inlines Autolinks // // The following CommonMark: @@ -14670,89 +14765,8 @@ namespace Markdig.Tests // Should be rendered as: //

http://foo.bar.baz

- Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 559, "Inlines Autolinks"); - TestParser.TestSpec("", "

http://foo.bar.baz

", ""); - } - } - [TestFixture] - public partial class TestInlinesAutolinks - { - [Test] - public void Example560() - { - // Example 560 - // Section: Inlines Autolinks - // - // The following CommonMark: - // - // - // Should be rendered as: - //

http://foo.bar.baz/test?q=hello&id=22&boolean

- - Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 560, "Inlines Autolinks"); - TestParser.TestSpec("", "

http://foo.bar.baz/test?q=hello&id=22&boolean

", ""); - } - } - [TestFixture] - public partial class TestInlinesAutolinks - { - [Test] - public void Example561() - { - // Example 561 - // Section: Inlines Autolinks - // - // The following CommonMark: - // - // - // Should be rendered as: - //

irc://foo.bar:2233/baz

- - Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 561, "Inlines Autolinks"); - TestParser.TestSpec("", "

irc://foo.bar:2233/baz

", ""); - } - } - // Uppercase is also fine: - [TestFixture] - public partial class TestInlinesAutolinks - { - [Test] - public void Example562() - { - // Example 562 - // Section: Inlines Autolinks - // - // The following CommonMark: - // - // - // Should be rendered as: - //

MAILTO:FOO@BAR.BAZ

- - Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 562, "Inlines Autolinks"); - TestParser.TestSpec("", "

MAILTO:FOO@BAR.BAZ

", ""); - } - } - // Note that many strings that count as [absolute URIs] for - // purposes of this spec are not valid URIs, because their - // schemes are not registered or because of other problems - // with their syntax: - [TestFixture] - public partial class TestInlinesAutolinks - { - [Test] - public void Example563() - { - // Example 563 - // Section: Inlines Autolinks - // - // The following CommonMark: - // - // - // Should be rendered as: - //

a+b+c:d

- Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 563, "Inlines Autolinks"); - TestParser.TestSpec("", "

a+b+c:d

", ""); + TestParser.TestSpec("", "

http://foo.bar.baz

", ""); } } [TestFixture] @@ -14765,13 +14779,13 @@ namespace Markdig.Tests // Section: Inlines Autolinks // // The following CommonMark: - // + // // // Should be rendered as: - //

made-up-scheme://foo,bar

+ //

http://foo.bar.baz/test?q=hello&id=22&boolean

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 564, "Inlines Autolinks"); - TestParser.TestSpec("", "

made-up-scheme://foo,bar

", ""); + TestParser.TestSpec("", "

http://foo.bar.baz/test?q=hello&id=22&boolean

", ""); } } [TestFixture] @@ -14784,15 +14798,16 @@ namespace Markdig.Tests // Section: Inlines Autolinks // // The following CommonMark: - // + // // // Should be rendered as: - //

http://../

+ //

irc://foo.bar:2233/baz

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 565, "Inlines Autolinks"); - TestParser.TestSpec("", "

http://../

", ""); + TestParser.TestSpec("", "

irc://foo.bar:2233/baz

", ""); } } + // Uppercase is also fine: [TestFixture] public partial class TestInlinesAutolinks { @@ -14803,16 +14818,19 @@ namespace Markdig.Tests // Section: Inlines Autolinks // // The following CommonMark: - // + // // // Should be rendered as: - //

localhost:5001/foo

+ //

MAILTO:FOO@BAR.BAZ

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 566, "Inlines Autolinks"); - TestParser.TestSpec("", "

localhost:5001/foo

", ""); + TestParser.TestSpec("", "

MAILTO:FOO@BAR.BAZ

", ""); } } - // Spaces are not allowed in autolinks: + // Note that many strings that count as [absolute URIs] for + // purposes of this spec are not valid URIs, because their + // schemes are not registered or because of other problems + // with their syntax: [TestFixture] public partial class TestInlinesAutolinks { @@ -14823,16 +14841,15 @@ namespace Markdig.Tests // Section: Inlines Autolinks // // The following CommonMark: - // + // // // Should be rendered as: - //

<http://foo.bar/baz bim>

+ //

a+b+c:d

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 567, "Inlines Autolinks"); - TestParser.TestSpec("", "

<http://foo.bar/baz bim>

", ""); + TestParser.TestSpec("", "

a+b+c:d

", ""); } } - // Backslash-escapes do not work inside autolinks: [TestFixture] public partial class TestInlinesAutolinks { @@ -14843,12 +14860,90 @@ namespace Markdig.Tests // Section: Inlines Autolinks // // The following CommonMark: + // + // + // Should be rendered as: + //

made-up-scheme://foo,bar

+ + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 568, "Inlines Autolinks"); + TestParser.TestSpec("", "

made-up-scheme://foo,bar

", ""); + } + } + [TestFixture] + public partial class TestInlinesAutolinks + { + [Test] + public void Example569() + { + // Example 569 + // Section: Inlines Autolinks + // + // The following CommonMark: + // + // + // Should be rendered as: + //

http://../

+ + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 569, "Inlines Autolinks"); + TestParser.TestSpec("", "

http://../

", ""); + } + } + [TestFixture] + public partial class TestInlinesAutolinks + { + [Test] + public void Example570() + { + // Example 570 + // Section: Inlines Autolinks + // + // The following CommonMark: + // + // + // Should be rendered as: + //

localhost:5001/foo

+ + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 570, "Inlines Autolinks"); + TestParser.TestSpec("", "

localhost:5001/foo

", ""); + } + } + // Spaces are not allowed in autolinks: + [TestFixture] + public partial class TestInlinesAutolinks + { + [Test] + public void Example571() + { + // Example 571 + // Section: Inlines Autolinks + // + // The following CommonMark: + // + // + // Should be rendered as: + //

<http://foo.bar/baz bim>

+ + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 571, "Inlines Autolinks"); + TestParser.TestSpec("", "

<http://foo.bar/baz bim>

", ""); + } + } + // Backslash-escapes do not work inside autolinks: + [TestFixture] + public partial class TestInlinesAutolinks + { + [Test] + public void Example572() + { + // Example 572 + // Section: Inlines Autolinks + // + // The following CommonMark: // // // Should be rendered as: //

http://example.com/\[\

- Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 568, "Inlines Autolinks"); + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 572, "Inlines Autolinks"); TestParser.TestSpec("", "

http://example.com/\\[\\

", ""); } } @@ -14870,9 +14965,9 @@ namespace Markdig.Tests public partial class TestInlinesAutolinks { [Test] - public void Example569() + public void Example573() { - // Example 569 + // Example 573 // Section: Inlines Autolinks // // The following CommonMark: @@ -14881,86 +14976,8 @@ namespace Markdig.Tests // Should be rendered as: //

foo@bar.example.com

- Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 569, "Inlines Autolinks"); - TestParser.TestSpec("", "

foo@bar.example.com

", ""); - } - } - [TestFixture] - public partial class TestInlinesAutolinks - { - [Test] - public void Example570() - { - // Example 570 - // Section: Inlines Autolinks - // - // The following CommonMark: - // - // - // Should be rendered as: - //

foo+special@Bar.baz-bar0.com

- - Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 570, "Inlines Autolinks"); - TestParser.TestSpec("", "

foo+special@Bar.baz-bar0.com

", ""); - } - } - // Backslash-escapes do not work inside email autolinks: - [TestFixture] - public partial class TestInlinesAutolinks - { - [Test] - public void Example571() - { - // Example 571 - // Section: Inlines Autolinks - // - // The following CommonMark: - // - // - // Should be rendered as: - //

<foo+@bar.example.com>

- - Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 571, "Inlines Autolinks"); - TestParser.TestSpec("", "

<foo+@bar.example.com>

", ""); - } - } - // These are not autolinks: - [TestFixture] - public partial class TestInlinesAutolinks - { - [Test] - public void Example572() - { - // Example 572 - // Section: Inlines Autolinks - // - // The following CommonMark: - // <> - // - // Should be rendered as: - //

<>

- - Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 572, "Inlines Autolinks"); - TestParser.TestSpec("<>", "

<>

", ""); - } - } - [TestFixture] - public partial class TestInlinesAutolinks - { - [Test] - public void Example573() - { - // Example 573 - // Section: Inlines Autolinks - // - // The following CommonMark: - // < http://foo.bar > - // - // Should be rendered as: - //

< http://foo.bar >

- Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 573, "Inlines Autolinks"); - TestParser.TestSpec("< http://foo.bar >", "

< http://foo.bar >

", ""); + TestParser.TestSpec("", "

foo@bar.example.com

", ""); } } [TestFixture] @@ -14973,15 +14990,16 @@ namespace Markdig.Tests // Section: Inlines Autolinks // // The following CommonMark: - // + // // // Should be rendered as: - //

<m:abc>

+ //

foo+special@Bar.baz-bar0.com

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 574, "Inlines Autolinks"); - TestParser.TestSpec("", "

<m:abc>

", ""); + TestParser.TestSpec("", "

foo+special@Bar.baz-bar0.com

", ""); } } + // Backslash-escapes do not work inside email autolinks: [TestFixture] public partial class TestInlinesAutolinks { @@ -14992,15 +15010,16 @@ namespace Markdig.Tests // Section: Inlines Autolinks // // The following CommonMark: - // + // // // Should be rendered as: - //

<foo.bar.baz>

+ //

<foo+@bar.example.com>

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 575, "Inlines Autolinks"); - TestParser.TestSpec("", "

<foo.bar.baz>

", ""); + TestParser.TestSpec("", "

<foo+@bar.example.com>

", ""); } } + // These are not autolinks: [TestFixture] public partial class TestInlinesAutolinks { @@ -15011,13 +15030,13 @@ namespace Markdig.Tests // Section: Inlines Autolinks // // The following CommonMark: - // http://example.com + // <> // // Should be rendered as: - //

http://example.com

+ //

<>

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 576, "Inlines Autolinks"); - TestParser.TestSpec("http://example.com", "

http://example.com

", ""); + TestParser.TestSpec("<>", "

<>

", ""); } } [TestFixture] @@ -15030,12 +15049,88 @@ namespace Markdig.Tests // Section: Inlines Autolinks // // The following CommonMark: + // < http://foo.bar > + // + // Should be rendered as: + //

< http://foo.bar >

+ + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 577, "Inlines Autolinks"); + TestParser.TestSpec("< http://foo.bar >", "

< http://foo.bar >

", ""); + } + } + [TestFixture] + public partial class TestInlinesAutolinks + { + [Test] + public void Example578() + { + // Example 578 + // Section: Inlines Autolinks + // + // The following CommonMark: + // + // + // Should be rendered as: + //

<m:abc>

+ + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 578, "Inlines Autolinks"); + TestParser.TestSpec("", "

<m:abc>

", ""); + } + } + [TestFixture] + public partial class TestInlinesAutolinks + { + [Test] + public void Example579() + { + // Example 579 + // Section: Inlines Autolinks + // + // The following CommonMark: + // + // + // Should be rendered as: + //

<foo.bar.baz>

+ + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 579, "Inlines Autolinks"); + TestParser.TestSpec("", "

<foo.bar.baz>

", ""); + } + } + [TestFixture] + public partial class TestInlinesAutolinks + { + [Test] + public void Example580() + { + // Example 580 + // Section: Inlines Autolinks + // + // The following CommonMark: + // http://example.com + // + // Should be rendered as: + //

http://example.com

+ + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 580, "Inlines Autolinks"); + TestParser.TestSpec("http://example.com", "

http://example.com

", ""); + } + } + [TestFixture] + public partial class TestInlinesAutolinks + { + [Test] + public void Example581() + { + // Example 581 + // Section: Inlines Autolinks + // + // The following CommonMark: // foo@bar.example.com // // Should be rendered as: //

foo@bar.example.com

- Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 577, "Inlines Autolinks"); + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 581, "Inlines Autolinks"); TestParser.TestSpec("foo@bar.example.com", "

foo@bar.example.com

", ""); } } @@ -15117,9 +15212,9 @@ namespace Markdig.Tests public partial class TestInlinesRawHTML { [Test] - public void Example578() + public void Example582() { - // Example 578 + // Example 582 // Section: Inlines Raw HTML // // The following CommonMark: @@ -15128,97 +15223,13 @@ namespace Markdig.Tests // Should be rendered as: //

- Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 578, "Inlines Raw HTML"); + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 582, "Inlines Raw HTML"); TestParser.TestSpec("", "

", ""); } } // Empty elements: [TestFixture] public partial class TestInlinesRawHTML - { - [Test] - public void Example579() - { - // Example 579 - // Section: Inlines Raw HTML - // - // The following CommonMark: - // - // - // Should be rendered as: - //

- - Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 579, "Inlines Raw HTML"); - TestParser.TestSpec("", "

", ""); - } - } - // [Whitespace] is allowed: - [TestFixture] - public partial class TestInlinesRawHTML - { - [Test] - public void Example580() - { - // Example 580 - // Section: Inlines Raw HTML - // - // The following CommonMark: - // - // - // Should be rendered as: - //

- - Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 580, "Inlines Raw HTML"); - TestParser.TestSpec("", "

", ""); - } - } - // With attributes: - [TestFixture] - public partial class TestInlinesRawHTML - { - [Test] - public void Example581() - { - // Example 581 - // Section: Inlines Raw HTML - // - // The following CommonMark: - // - // - // Should be rendered as: - //

- - Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 581, "Inlines Raw HTML"); - TestParser.TestSpec("", "

", ""); - } - } - // Custom tag names can be used: - [TestFixture] - public partial class TestInlinesRawHTML - { - [Test] - public void Example582() - { - // Example 582 - // Section: Inlines Raw HTML - // - // The following CommonMark: - // Foo - // - // Should be rendered as: - //

Foo

- - Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 582, "Inlines Raw HTML"); - TestParser.TestSpec("Foo ", "

Foo

", ""); - } - } - // Illegal tag names, not parsed as HTML: - [TestFixture] - public partial class TestInlinesRawHTML { [Test] public void Example583() @@ -15227,16 +15238,16 @@ namespace Markdig.Tests // Section: Inlines Raw HTML // // The following CommonMark: - // <33> <__> + //
// // Should be rendered as: - //

<33> <__>

+ //

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 583, "Inlines Raw HTML"); - TestParser.TestSpec("<33> <__>", "

<33> <__>

", ""); + TestParser.TestSpec("
", "

", ""); } } - // Illegal attribute names: + // [Whitespace] is allowed: [TestFixture] public partial class TestInlinesRawHTML { @@ -15247,16 +15258,18 @@ namespace Markdig.Tests // Section: Inlines Raw HTML // // The following CommonMark: - // + // // // Should be rendered as: - //

<a h*#ref="hi">

+ //

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 584, "Inlines Raw HTML"); - TestParser.TestSpec("", "

<a h*#ref="hi">

", ""); + TestParser.TestSpec("
", "

", ""); } } - // Illegal attribute values: + // With attributes: [TestFixture] public partial class TestInlinesRawHTML { @@ -15267,16 +15280,18 @@ namespace Markdig.Tests // Section: Inlines Raw HTML // // The following CommonMark: - // // // Should be rendered as: - //

<a href="hi'> <a href=hi'>

+ //

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 585, "Inlines Raw HTML"); - TestParser.TestSpec(" ", "

<a href="hi'> <a href=hi'>

", ""); + TestParser.TestSpec("
", "

", ""); } } - // Illegal [whitespace]: + // Custom tag names can be used: [TestFixture] public partial class TestInlinesRawHTML { @@ -15287,18 +15302,16 @@ namespace Markdig.Tests // Section: Inlines Raw HTML // // The following CommonMark: - // < a>< - // foo> + // Foo // // Should be rendered as: - //

< a>< - // foo><bar/ >

+ //

Foo

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 586, "Inlines Raw HTML"); - TestParser.TestSpec("< a><\nfoo>", "

< a><\nfoo><bar/ >

", ""); + TestParser.TestSpec("Foo ", "

Foo

", ""); } } - // Missing [whitespace]: + // Illegal tag names, not parsed as HTML: [TestFixture] public partial class TestInlinesRawHTML { @@ -15309,16 +15322,16 @@ namespace Markdig.Tests // Section: Inlines Raw HTML // // The following CommonMark: - //
+ // <33> <__> // // Should be rendered as: - //

<a href='bar'title=title>

+ //

<33> <__>

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 587, "Inlines Raw HTML"); - TestParser.TestSpec("
", "

<a href='bar'title=title>

", ""); + TestParser.TestSpec("<33> <__>", "

<33> <__>

", ""); } } - // Closing tags: + // Illegal attribute names: [TestFixture] public partial class TestInlinesRawHTML { @@ -15329,16 +15342,16 @@ namespace Markdig.Tests // Section: Inlines Raw HTML // // The following CommonMark: - //
+ // // // Should be rendered as: - //

+ //

<a h*#ref="hi">

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 588, "Inlines Raw HTML"); - TestParser.TestSpec("", "

", ""); + TestParser.TestSpec("", "

<a h*#ref="hi">

", ""); } } - // Illegal attributes in closing tag: + // Illegal attribute values: [TestFixture] public partial class TestInlinesRawHTML { @@ -15349,16 +15362,16 @@ namespace Markdig.Tests // Section: Inlines Raw HTML // // The following CommonMark: - //
+ // ", "

</a href="foo">

", ""); + TestParser.TestSpec("
", "

<a href="hi'> <a href=hi'>

", ""); } } - // Comments: + // Illegal [whitespace]: [TestFixture] public partial class TestInlinesRawHTML { @@ -15369,17 +15382,18 @@ namespace Markdig.Tests // Section: Inlines Raw HTML // // The following CommonMark: - // foo + // < a>< + // foo> // // Should be rendered as: - //

foo

+ //

< a>< + // foo><bar/ >

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 590, "Inlines Raw HTML"); - TestParser.TestSpec("foo ", "

foo

", ""); + TestParser.TestSpec("< a><\nfoo>", "

< a><\nfoo><bar/ >

", ""); } } + // Missing [whitespace]: [TestFixture] public partial class TestInlinesRawHTML { @@ -15390,12 +15404,93 @@ namespace Markdig.Tests // Section: Inlines Raw HTML // // The following CommonMark: + //
+ // + // Should be rendered as: + //

<a href='bar'title=title>

+ + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 591, "Inlines Raw HTML"); + TestParser.TestSpec("
", "

<a href='bar'title=title>

", ""); + } + } + // Closing tags: + [TestFixture] + public partial class TestInlinesRawHTML + { + [Test] + public void Example592() + { + // Example 592 + // Section: Inlines Raw HTML + // + // The following CommonMark: + //
+ // + // Should be rendered as: + //

+ + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 592, "Inlines Raw HTML"); + TestParser.TestSpec("", "

", ""); + } + } + // Illegal attributes in closing tag: + [TestFixture] + public partial class TestInlinesRawHTML + { + [Test] + public void Example593() + { + // Example 593 + // Section: Inlines Raw HTML + // + // The following CommonMark: + // + // + // Should be rendered as: + //

</a href="foo">

+ + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 593, "Inlines Raw HTML"); + TestParser.TestSpec("", "

</a href="foo">

", ""); + } + } + // Comments: + [TestFixture] + public partial class TestInlinesRawHTML + { + [Test] + public void Example594() + { + // Example 594 + // Section: Inlines Raw HTML + // + // The following CommonMark: + // foo + // + // Should be rendered as: + //

foo

+ + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 594, "Inlines Raw HTML"); + TestParser.TestSpec("foo ", "

foo

", ""); + } + } + [TestFixture] + public partial class TestInlinesRawHTML + { + [Test] + public void Example595() + { + // Example 595 + // Section: Inlines Raw HTML + // + // The following CommonMark: // foo // // Should be rendered as: //

foo <!-- not a comment -- two hyphens -->

- Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 591, "Inlines Raw HTML"); + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 595, "Inlines Raw HTML"); TestParser.TestSpec("foo ", "

foo <!-- not a comment -- two hyphens -->

", ""); } } @@ -15404,9 +15499,9 @@ namespace Markdig.Tests public partial class TestInlinesRawHTML { [Test] - public void Example592() + public void Example596() { - // Example 592 + // Example 596 // Section: Inlines Raw HTML // // The following CommonMark: @@ -15418,94 +15513,13 @@ namespace Markdig.Tests //

foo <!--> foo -->

//

foo <!-- foo--->

- Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 592, "Inlines Raw HTML"); + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 596, "Inlines Raw HTML"); TestParser.TestSpec("foo foo -->\n\nfoo ", "

foo <!--> foo -->

\n

foo <!-- foo--->

", ""); } } // Processing instructions: [TestFixture] public partial class TestInlinesRawHTML - { - [Test] - public void Example593() - { - // Example 593 - // Section: Inlines Raw HTML - // - // The following CommonMark: - // foo - // - // Should be rendered as: - //

foo

- - Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 593, "Inlines Raw HTML"); - TestParser.TestSpec("foo ", "

foo

", ""); - } - } - // Declarations: - [TestFixture] - public partial class TestInlinesRawHTML - { - [Test] - public void Example594() - { - // Example 594 - // Section: Inlines Raw HTML - // - // The following CommonMark: - // foo - // - // Should be rendered as: - //

foo

- - Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 594, "Inlines Raw HTML"); - TestParser.TestSpec("foo ", "

foo

", ""); - } - } - // CDATA sections: - [TestFixture] - public partial class TestInlinesRawHTML - { - [Test] - public void Example595() - { - // Example 595 - // Section: Inlines Raw HTML - // - // The following CommonMark: - // foo &<]]> - // - // Should be rendered as: - //

foo &<]]>

- - Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 595, "Inlines Raw HTML"); - TestParser.TestSpec("foo &<]]>", "

foo &<]]>

", ""); - } - } - // Entity and numeric character references are preserved in HTML - // attributes: - [TestFixture] - public partial class TestInlinesRawHTML - { - [Test] - public void Example596() - { - // Example 596 - // Section: Inlines Raw HTML - // - // The following CommonMark: - // foo - // - // Should be rendered as: - //

foo

- - Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 596, "Inlines Raw HTML"); - TestParser.TestSpec("foo ", "

foo

", ""); - } - } - // Backslash escapes do not work in HTML attributes: - [TestFixture] - public partial class TestInlinesRawHTML { [Test] public void Example597() @@ -15514,15 +15528,16 @@ namespace Markdig.Tests // Section: Inlines Raw HTML // // The following CommonMark: - // foo + // foo // // Should be rendered as: - //

foo

+ //

foo

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 597, "Inlines Raw HTML"); - TestParser.TestSpec("foo
", "

foo

", ""); + TestParser.TestSpec("foo ", "

foo

", ""); } } + // Declarations: [TestFixture] public partial class TestInlinesRawHTML { @@ -15533,12 +15548,92 @@ namespace Markdig.Tests // Section: Inlines Raw HTML // // The following CommonMark: + // foo + // + // Should be rendered as: + //

foo

+ + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 598, "Inlines Raw HTML"); + TestParser.TestSpec("foo ", "

foo

", ""); + } + } + // CDATA sections: + [TestFixture] + public partial class TestInlinesRawHTML + { + [Test] + public void Example599() + { + // Example 599 + // Section: Inlines Raw HTML + // + // The following CommonMark: + // foo &<]]> + // + // Should be rendered as: + //

foo &<]]>

+ + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 599, "Inlines Raw HTML"); + TestParser.TestSpec("foo &<]]>", "

foo &<]]>

", ""); + } + } + // Entity and numeric character references are preserved in HTML + // attributes: + [TestFixture] + public partial class TestInlinesRawHTML + { + [Test] + public void Example600() + { + // Example 600 + // Section: Inlines Raw HTML + // + // The following CommonMark: + // foo
+ // + // Should be rendered as: + //

foo

+ + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 600, "Inlines Raw HTML"); + TestParser.TestSpec("foo ", "

foo

", ""); + } + } + // Backslash escapes do not work in HTML attributes: + [TestFixture] + public partial class TestInlinesRawHTML + { + [Test] + public void Example601() + { + // Example 601 + // Section: Inlines Raw HTML + // + // The following CommonMark: + // foo + // + // Should be rendered as: + //

foo

+ + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 601, "Inlines Raw HTML"); + TestParser.TestSpec("foo ", "

foo

", ""); + } + } + [TestFixture] + public partial class TestInlinesRawHTML + { + [Test] + public void Example602() + { + // Example 602 + // Section: Inlines Raw HTML + // + // The following CommonMark: // // // Should be rendered as: //

<a href=""">

- Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 598, "Inlines Raw HTML"); + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 602, "Inlines Raw HTML"); TestParser.TestSpec("
", "

<a href=""">

", ""); } } @@ -15550,94 +15645,6 @@ namespace Markdig.Tests // in HTML as a `
` tag): [TestFixture] public partial class TestInlinesHardlinebreaks - { - [Test] - public void Example599() - { - // Example 599 - // Section: Inlines Hard line breaks - // - // The following CommonMark: - // foo - // baz - // - // Should be rendered as: - //

foo
- // baz

- - Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 599, "Inlines Hard line breaks"); - TestParser.TestSpec("foo \nbaz", "

foo
\nbaz

", ""); - } - } - // For a more visible alternative, a backslash before the - // [line ending] may be used instead of two spaces: - [TestFixture] - public partial class TestInlinesHardlinebreaks - { - [Test] - public void Example600() - { - // Example 600 - // Section: Inlines Hard line breaks - // - // The following CommonMark: - // foo\ - // baz - // - // Should be rendered as: - //

foo
- // baz

- - Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 600, "Inlines Hard line breaks"); - TestParser.TestSpec("foo\\\nbaz", "

foo
\nbaz

", ""); - } - } - // More than two spaces can be used: - [TestFixture] - public partial class TestInlinesHardlinebreaks - { - [Test] - public void Example601() - { - // Example 601 - // Section: Inlines Hard line breaks - // - // The following CommonMark: - // foo - // baz - // - // Should be rendered as: - //

foo
- // baz

- - Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 601, "Inlines Hard line breaks"); - TestParser.TestSpec("foo \nbaz", "

foo
\nbaz

", ""); - } - } - // Leading spaces at the beginning of the next line are ignored: - [TestFixture] - public partial class TestInlinesHardlinebreaks - { - [Test] - public void Example602() - { - // Example 602 - // Section: Inlines Hard line breaks - // - // The following CommonMark: - // foo - // bar - // - // Should be rendered as: - //

foo
- // bar

- - Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 602, "Inlines Hard line breaks"); - TestParser.TestSpec("foo \n bar", "

foo
\nbar

", ""); - } - } - [TestFixture] - public partial class TestInlinesHardlinebreaks { [Test] public void Example603() @@ -15646,19 +15653,19 @@ namespace Markdig.Tests // Section: Inlines Hard line breaks // // The following CommonMark: - // foo\ - // bar + // foo + // baz // // Should be rendered as: //

foo
- // bar

+ // baz

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 603, "Inlines Hard line breaks"); - TestParser.TestSpec("foo\\\n bar", "

foo
\nbar

", ""); + TestParser.TestSpec("foo \nbaz", "

foo
\nbaz

", ""); } } - // Line breaks can occur inside emphasis, links, and other constructs - // that allow inline content: + // For a more visible alternative, a backslash before the + // [line ending] may be used instead of two spaces: [TestFixture] public partial class TestInlinesHardlinebreaks { @@ -15669,17 +15676,18 @@ namespace Markdig.Tests // Section: Inlines Hard line breaks // // The following CommonMark: - // *foo - // bar* + // foo\ + // baz // // Should be rendered as: - //

foo
- // bar

+ //

foo
+ // baz

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 604, "Inlines Hard line breaks"); - TestParser.TestSpec("*foo \nbar*", "

foo
\nbar

", ""); + TestParser.TestSpec("foo\\\nbaz", "

foo
\nbaz

", ""); } } + // More than two spaces can be used: [TestFixture] public partial class TestInlinesHardlinebreaks { @@ -15690,18 +15698,18 @@ namespace Markdig.Tests // Section: Inlines Hard line breaks // // The following CommonMark: - // *foo\ - // bar* + // foo + // baz // // Should be rendered as: - //

foo
- // bar

+ //

foo
+ // baz

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 605, "Inlines Hard line breaks"); - TestParser.TestSpec("*foo\\\nbar*", "

foo
\nbar

", ""); + TestParser.TestSpec("foo \nbaz", "

foo
\nbaz

", ""); } } - // Line breaks do not occur inside code spans + // Leading spaces at the beginning of the next line are ignored: [TestFixture] public partial class TestInlinesHardlinebreaks { @@ -15712,14 +15720,15 @@ namespace Markdig.Tests // Section: Inlines Hard line breaks // // The following CommonMark: - // `code - // span` + // foo + // bar // // Should be rendered as: - //

code span

+ //

foo
+ // bar

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 606, "Inlines Hard line breaks"); - TestParser.TestSpec("`code \nspan`", "

code span

", ""); + TestParser.TestSpec("foo \n bar", "

foo
\nbar

", ""); } } [TestFixture] @@ -15732,17 +15741,19 @@ namespace Markdig.Tests // Section: Inlines Hard line breaks // // The following CommonMark: - // `code\ - // span` + // foo\ + // bar // // Should be rendered as: - //

code\ span

+ //

foo
+ // bar

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 607, "Inlines Hard line breaks"); - TestParser.TestSpec("`code\\\nspan`", "

code\\ span

", ""); + TestParser.TestSpec("foo\\\n bar", "

foo
\nbar

", ""); } } - // or HTML tags: + // Line breaks can occur inside emphasis, links, and other constructs + // that allow inline content: [TestFixture] public partial class TestInlinesHardlinebreaks { @@ -15753,15 +15764,15 @@ namespace Markdig.Tests // Section: Inlines Hard line breaks // // The following CommonMark: - //
+ // *foo + // bar* // // Should be rendered as: - //

+ //

foo
+ // bar

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 608, "Inlines Hard line breaks"); - TestParser.TestSpec("
", "

", ""); + TestParser.TestSpec("*foo \nbar*", "

foo
\nbar

", ""); } } [TestFixture] @@ -15774,20 +15785,18 @@ namespace Markdig.Tests // Section: Inlines Hard line breaks // // The following CommonMark: - //
+ // *foo\ + // bar* // // Should be rendered as: - //

+ //

foo
+ // bar

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 609, "Inlines Hard line breaks"); - TestParser.TestSpec("
", "

", ""); + TestParser.TestSpec("*foo\\\nbar*", "

foo
\nbar

", ""); } } - // Hard line breaks are for separating inline content within a block. - // Neither syntax for hard line breaks works at the end of a paragraph or - // other block element: + // Line breaks do not occur inside code spans [TestFixture] public partial class TestInlinesHardlinebreaks { @@ -15798,13 +15807,14 @@ namespace Markdig.Tests // Section: Inlines Hard line breaks // // The following CommonMark: - // foo\ + // `code + // span` // // Should be rendered as: - //

foo\

+ //

code span

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 610, "Inlines Hard line breaks"); - TestParser.TestSpec("foo\\", "

foo\\

", ""); + TestParser.TestSpec("`code \nspan`", "

code span

", ""); } } [TestFixture] @@ -15817,15 +15827,17 @@ namespace Markdig.Tests // Section: Inlines Hard line breaks // // The following CommonMark: - // foo + // `code\ + // span` // // Should be rendered as: - //

foo

+ //

code\ span

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 611, "Inlines Hard line breaks"); - TestParser.TestSpec("foo ", "

foo

", ""); + TestParser.TestSpec("`code\\\nspan`", "

code\\ span

", ""); } } + // or HTML tags: [TestFixture] public partial class TestInlinesHardlinebreaks { @@ -15836,13 +15848,15 @@ namespace Markdig.Tests // Section: Inlines Hard line breaks // // The following CommonMark: - // ### foo\ + //
// // Should be rendered as: - //

foo\

+ //

Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 612, "Inlines Hard line breaks"); - TestParser.TestSpec("### foo\\", "

foo\\

", ""); + TestParser.TestSpec("
", "

", ""); } } [TestFixture] @@ -15855,12 +15869,93 @@ namespace Markdig.Tests // Section: Inlines Hard line breaks // // The following CommonMark: + // + // + // Should be rendered as: + //

+ + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 613, "Inlines Hard line breaks"); + TestParser.TestSpec("", "

", ""); + } + } + // Hard line breaks are for separating inline content within a block. + // Neither syntax for hard line breaks works at the end of a paragraph or + // other block element: + [TestFixture] + public partial class TestInlinesHardlinebreaks + { + [Test] + public void Example614() + { + // Example 614 + // Section: Inlines Hard line breaks + // + // The following CommonMark: + // foo\ + // + // Should be rendered as: + //

foo\

+ + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 614, "Inlines Hard line breaks"); + TestParser.TestSpec("foo\\", "

foo\\

", ""); + } + } + [TestFixture] + public partial class TestInlinesHardlinebreaks + { + [Test] + public void Example615() + { + // Example 615 + // Section: Inlines Hard line breaks + // + // The following CommonMark: + // foo + // + // Should be rendered as: + //

foo

+ + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 615, "Inlines Hard line breaks"); + TestParser.TestSpec("foo ", "

foo

", ""); + } + } + [TestFixture] + public partial class TestInlinesHardlinebreaks + { + [Test] + public void Example616() + { + // Example 616 + // Section: Inlines Hard line breaks + // + // The following CommonMark: + // ### foo\ + // + // Should be rendered as: + //

foo\

+ + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 616, "Inlines Hard line breaks"); + TestParser.TestSpec("### foo\\", "

foo\\

", ""); + } + } + [TestFixture] + public partial class TestInlinesHardlinebreaks + { + [Test] + public void Example617() + { + // Example 617 + // Section: Inlines Hard line breaks + // + // The following CommonMark: // ### foo // // Should be rendered as: //

foo

- Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 613, "Inlines Hard line breaks"); + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 617, "Inlines Hard line breaks"); TestParser.TestSpec("### foo ", "

foo

", ""); } } @@ -15875,9 +15970,9 @@ namespace Markdig.Tests public partial class TestInlinesSoftlinebreaks { [Test] - public void Example614() + public void Example618() { - // Example 614 + // Example 618 // Section: Inlines Soft line breaks // // The following CommonMark: @@ -15888,7 +15983,7 @@ namespace Markdig.Tests //

foo // baz

- Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 614, "Inlines Soft line breaks"); + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 618, "Inlines Soft line breaks"); TestParser.TestSpec("foo\nbaz", "

foo\nbaz

", ""); } } @@ -15898,9 +15993,9 @@ namespace Markdig.Tests public partial class TestInlinesSoftlinebreaks { [Test] - public void Example615() + public void Example619() { - // Example 615 + // Example 619 // Section: Inlines Soft line breaks // // The following CommonMark: @@ -15911,7 +16006,7 @@ namespace Markdig.Tests //

foo // baz

- Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 615, "Inlines Soft line breaks"); + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 619, "Inlines Soft line breaks"); TestParser.TestSpec("foo \n baz", "

foo\nbaz

", ""); } } @@ -15929,9 +16024,9 @@ namespace Markdig.Tests public partial class TestInlinesTextualcontent { [Test] - public void Example616() + public void Example620() { - // Example 616 + // Example 620 // Section: Inlines Textual content // // The following CommonMark: @@ -15940,7 +16035,7 @@ namespace Markdig.Tests // Should be rendered as: //

hello $.;'there

- Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 616, "Inlines Textual content"); + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 620, "Inlines Textual content"); TestParser.TestSpec("hello $.;'there", "

hello $.;'there

", ""); } } @@ -15948,9 +16043,9 @@ namespace Markdig.Tests public partial class TestInlinesTextualcontent { [Test] - public void Example617() + public void Example621() { - // Example 617 + // Example 621 // Section: Inlines Textual content // // The following CommonMark: @@ -15959,7 +16054,7 @@ namespace Markdig.Tests // Should be rendered as: //

Foo χρῆν

- Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 617, "Inlines Textual content"); + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 621, "Inlines Textual content"); TestParser.TestSpec("Foo χρῆν", "

Foo χρῆν

", ""); } } @@ -15968,9 +16063,9 @@ namespace Markdig.Tests public partial class TestInlinesTextualcontent { [Test] - public void Example618() + public void Example622() { - // Example 618 + // Example 622 // Section: Inlines Textual content // // The following CommonMark: @@ -15979,7 +16074,7 @@ namespace Markdig.Tests // Should be rendered as: //

Multiple spaces

- Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 618, "Inlines Textual content"); + Console.WriteLine("Example {0}" + Environment.NewLine + "Section: {0}" + Environment.NewLine, 622, "Inlines Textual content"); TestParser.TestSpec("Multiple spaces", "

Multiple spaces

", ""); } } @@ -16053,7 +16148,7 @@ namespace Markdig.Tests // [lazy continuation line]. // // 2. Next, after consuming the continuation markers for existing - // blocks, we look for new block starts (e.g. `>` for a block quote. + // blocks, we look for new block starts (e.g. `>` for a block quote). // If we encounter a new block start, we close any blocks unmatched // in step 1 before creating the new block as a child of the last // matched block. diff --git a/src/Markdig.Tests/Specs/Specs.tt b/src/Markdig.Tests/Specs/Specs.tt index 13d357ac..2650c7d8 100644 --- a/src/Markdig.Tests/Specs/Specs.tt +++ b/src/Markdig.Tests/Specs/Specs.tt @@ -39,7 +39,7 @@ SOFTWARE. <#@ output extension=".cs" #><# var specFiles = new KeyValuePair[] { // new KeyValuePair("https://raw.githubusercontent.com/jgm/CommonMark/master/spec.txt", string.Empty), - new KeyValuePair("https://raw.githubusercontent.com/jgm/CommonMark/91e045ca370258903ed138450373043a496ec64b/spec.txt", string.Empty), // 0.26 specs + new KeyValuePair("https://raw.githubusercontent.com/jgm/CommonMark/cfc84164475d3bec8be9482c21a705adc93a54f5/spec.txt", string.Empty), // 0.26 specs new KeyValuePair(Host.ResolvePath("PipeTableSpecs.md"), "pipetables|advanced"), new KeyValuePair(Host.ResolvePath("FootnotesSpecs.md"), "footnotes|advanced"), new KeyValuePair(Host.ResolvePath("GenericAttributesSpecs.md"), "attributes|advanced"), diff --git a/src/Markdig/Parsers/Inlines/LinkInlineParser.cs b/src/Markdig/Parsers/Inlines/LinkInlineParser.cs index 683e8acb..2ac41bb9 100644 --- a/src/Markdig/Parsers/Inlines/LinkInlineParser.cs +++ b/src/Markdig/Parsers/Inlines/LinkInlineParser.cs @@ -211,6 +211,7 @@ namespace Markdig.Parsers.Inlines // compact reference link/image, // or shortcut reference link/image var parentDelimiter = openParent.Parent; + var savedText = text; switch (text.CurrentChar) { case '(': @@ -253,9 +254,10 @@ namespace Markdig.Parsers.Inlines return true; } - break; - default: + text = savedText; + goto default; + default: var labelSpan = SourceSpan.Empty; string label = null; bool isLabelSpanLocal = true;