nip54: djot parser.
This commit is contained in:
@@ -4,6 +4,8 @@ import (
|
||||
"strings"
|
||||
"unicode"
|
||||
|
||||
"github.com/sivukhin/godjot/djot_parser"
|
||||
"github.com/sivukhin/godjot/html_writer"
|
||||
"golang.org/x/text/transform"
|
||||
"golang.org/x/text/unicode/norm"
|
||||
)
|
||||
@@ -24,3 +26,13 @@ func NormalizeIdentifier(name string) string {
|
||||
|
||||
return string(b)
|
||||
}
|
||||
|
||||
func ArticleAsHTML(content string) string {
|
||||
ast := djot_parser.BuildDjotAst([]byte(content))
|
||||
context := djot_parser.NewConversionContext("html", djot_parser.DefaultConversionRegistry)
|
||||
writer := &html_writer.HtmlWriter{}
|
||||
for _, node := range ast {
|
||||
context.ConvertDjotToHtml(writer, node)
|
||||
}
|
||||
return writer.String()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user