Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
statup-github committed Jan 16, 2023
1 parent d5e502b commit 37eacb9
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 9 deletions.
4 changes: 2 additions & 2 deletions tests/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ and finally the outer one:
// Output:
// <h2>Hello</h2>
// <p>The following contains an id and a class</p>
// <div id="big-div" class="add-border">
// <div data-fence="0" id="big-div" class="add-border">
// <p>And the next fence contains two classes.</p>
// <div class="background-green font-big">
// <div data-fence="1" class="background-green font-big">
// <h2>This is nested within nested fences</h2>
// <p>here we close the inner fence:</p>
// </div>
Expand Down
43 changes: 37 additions & 6 deletions tests/indent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,40 @@ import (
"github.com/yuin/goldmark/text"
)

func Example_indent_2() {
srcString := `
## Hello
This is outside
:::{}
This is inside
still inside
:::
Outside again.`

src := []byte(srcString)

markdown := goldmark.New(
goldmark.WithExtensions(
&fences.Extender{},
),
)

doc := markdown.Parser().Parse(text.NewReader(src))
markdown.Renderer().Render(os.Stdout, src, doc)

// Output:
// <h2>Hello</h2>
// <p>This is outside</p>
// <div data-fence="0">
// <p>This is inside</p>
// <p>still inside</p>
// </div>
// <p>Outside again.</p>
}

func Example_indent() {
srcString := strings.ReplaceAll(`
## Hello
Expand Down Expand Up @@ -38,8 +72,6 @@ this is unindented code
::: {.background-yellow}
This is not indented
:::
this is not indented enough
:::`, "§", "`")
src := []byte(srcString)

Expand All @@ -59,18 +91,17 @@ this is not indented enough
// </code></pre>
// <pre><code>this is indented code
// </code></pre>
// <div data-fenceid="XVlBzgbaiCMRAjWwhTHctcuA" id="big-div" class="add-border">
// <div data-fence="0" id="big-div" class="add-border">
// <p>This is indented</p>
// <div data-fenceid="xhxKQFDaFpLSjFbcXoEFfRsW" class="background-green font-big">
// <div data-fence="1" class="background-green font-big">
// <h2>This is indented within indented</h2>
// <pre><code>this is unindented code in an indented block
// </code></pre>
// <pre><code>This is indented code in an indented block
// </code></pre>
// </div>
// <div data-fenceid="xPLDnJObCsNVlgTeMaPEZQle" class="background-yellow">
// <div data-fence="1" class="background-yellow">
// <p>This is not indented</p>
// </div>
// <p>s is not indented enough</p>
// </div>
}
2 changes: 1 addition & 1 deletion tests/no_attributes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ This is not fenced because we can't differentiate between nested and closing ":"
// Output:
// <h2>Hello</h2>
// <p>The following contains no classes</p>
// <div>
// <div data-fence="0">
// <p>This is fenced</p>
// </div>
// <p>But you need something to denote opening &quot;:&quot;</p>
Expand Down

0 comments on commit 37eacb9

Please sign in to comment.