Pass through raw HTML in Markdown

This commit is contained in:
Neale Pickett 2021-02-18 17:54:26 -07:00
parent 1c2dd4695f
commit 2e0dfb601a
3 changed files with 8 additions and 1 deletions

View File

@ -21,6 +21,7 @@ import (
"github.com/spf13/afero"
"github.com/yuin/goldmark"
"github.com/yuin/goldmark/extension"
"github.com/yuin/goldmark/renderer/html"
"gopkg.in/yaml.v2"
)
@ -292,6 +293,9 @@ func (fp FsPuzzle) staticPuzzle() (StaticPuzzle, []byte, error) {
extension.Table,
extension.DefinitionList,
),
goldmark.WithRendererOptions(
html.WithUnsafe(),
),
)
md.Convert(bodyBuf.Bytes(), body)

View File

@ -108,8 +108,10 @@ func TestFsPuzzle(t *testing.T) {
t.Error(err)
}
if _, err := NewFsPuzzlePoints(catFs, 2).Puzzle(); err != nil {
if puzzle, err := NewFsPuzzlePoints(catFs, 2).Puzzle(); err != nil {
t.Error(err)
} else if !strings.Contains(puzzle.Pre.Body, "class=\"moo\"") {
t.Error("Raw HTML didn't make it through")
}
mkpuzzleDir := NewFsPuzzlePoints(catFs, 3)

View File

@ -23,3 +23,4 @@ This is a moth file, woo wo!
* moo
* squeak
<span class="moo">a span tag</span>