Skip to content

Commit

Permalink
markup/goldmark: latex fences tests
Browse files Browse the repository at this point in the history
  • Loading branch information
j2kun committed Jan 6, 2024
1 parent 911bc60 commit 0ee8248
Showing 1 changed file with 71 additions and 0 deletions.
71 changes: 71 additions & 0 deletions markup/goldmark/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -711,3 +711,74 @@ echo "hello";
b := hugolib.Test(t, files)
b.AssertFileContent("public/index.html", "<div class=foo><?php\necho \"hello\";\n?>\n</div>")
}

// Issue #10894
func TestLatexInlineFences(t *testing.T) {
t.Parallel()

files := `
-- config.toml --
[markup]
[markup.goldmark]
[markup.goldmark.extensions]
latex = true
-- content/p1.md --
---
title: "p1"
---
## LaTeX test
Inline equation that would be mangled by default parser: $a^*=x-b^*$
-- layouts/_default/single.html --
{{ .Content }}
`

b := hugolib.NewIntegrationTestBuilder(
hugolib.IntegrationTestConfig{
T: t,
TxtarString: files,
NeedsOsFS: false,
},
).Build()

b.AssertFileContent("public/p1/index.html", `
$a^*=x-b^*$
`)
}

func TestLatexBlockFences(t *testing.T) {
t.Parallel()

files := `
-- config.toml --
[markup]
[markup.goldmark]
[markup.goldmark.extensions]
latex = true
-- content/p1.md --
---
title: "p1"
---
## LaTeX test
Block equation that would be mangled by default parser:
$$a^*=x-b^*$$
-- layouts/_default/single.html --
{{ .Content }}
`

b := hugolib.NewIntegrationTestBuilder(
hugolib.IntegrationTestConfig{
T: t,
TxtarString: files,
NeedsOsFS: false,
},
).Build()

b.AssertFileContent("public/p1/index.html", `
$a^*=x-b^*$
`)
}

0 comments on commit 0ee8248

Please sign in to comment.