Skip to content

Commit

Permalink
unescape html in code
Browse files Browse the repository at this point in the history
  • Loading branch information
Miles Maddox committed Apr 7, 2018
1 parent f3317ad commit ab5f0cf
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"
"github.com/a8m/mark"
"github.com/justmiles/go-confluence"
"html"
"io"
"io/ioutil"
"os"
Expand Down Expand Up @@ -104,7 +105,10 @@ func check(e error, s string) {
}

func renderContent(s string) string {
m := mark.New(s, nil)
m := mark.New(s, &mark.Options{
Gfm: false,
Smartypants: true,
})
m.AddRenderFn(mark.NodeCode, func(node mark.Node) (s string) {
p, _ := node.(*mark.CodeNode)
lineCount, _ := lineCounter(p.Text)
Expand All @@ -119,7 +123,7 @@ func renderContent(s string) string {
if p.Lang != "" {
s += fmt.Sprintf(`<ac:parameter ac:name="language">%s</ac:parameter>`, p.Lang)
}
s += fmt.Sprintf(`<ac:plain-text-body><![CDATA[%s]]></ac:plain-text-body>`, p.Text)
s += fmt.Sprintf(`<ac:plain-text-body><![CDATA[%s]]></ac:plain-text-body>`, html.UnescapeString(p.Text))
s += `</ac:structured-macro>`
return s
})
Expand Down

0 comments on commit ab5f0cf

Please sign in to comment.