Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/Markdig.Tests/Specs/GenericAttributesSpecs.generated.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,22 @@ public void ExtensionsGenericAttributes_Example003()

TestParser.TestSpec("[Foo](url){data-x=1}\n\n[Foo](url){data-x='1'}\n\n[Foo](url){data-x=11}", "<p><a href=\"url\" data-x=\"1\">Foo</a></p>\n<p><a href=\"url\" data-x=\"1\">Foo</a></p>\n<p><a href=\"url\" data-x=\"11\">Foo</a></p>", "attributes|advanced", context: "Example 3\nSection Extensions / Generic Attributes\n");
}

// Attributes that occur immediately before a block element, on a line by themselves, affect that element
[Test]
public void ExtensionsGenericAttributes_Example004()
{
// Example 4
// Section: Extensions / Generic Attributes
//
// The following Markdown:
// {.center}
// A paragraph
//
// Should be rendered as:
// <p class="center">A paragraph</p>

TestParser.TestSpec("{.center}\nA paragraph", "<p class=\"center\">A paragraph</p>", "attributes|advanced", context: "Example 4\nSection Extensions / Generic Attributes\n");
}
}
}
9 changes: 9 additions & 0 deletions src/Markdig.Tests/Specs/GenericAttributesSpecs.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,12 @@ Attribute values can be one character long
<p><a href="url" data-x="1">Foo</a></p>
<p><a href="url" data-x="11">Foo</a></p>
````````````````````````````````

Attributes that occur immediately before a block element, on a line by themselves, affect that element

```````````````````````````````` example
{.center}
A paragraph
.
<p class="center">A paragraph</p>
````````````````````````````````
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ public static bool TryParse(ref StringSlice slice, [NotNullWhen(true)] out HtmlA
{
isValid = true;
line.SkipChar(); // skip }
if (line.CurrentChar == '\n')
{
line.SkipChar(); // skip \n
}
break;
}

Expand Down