Skip to content

Instantly share code, notes, and snippets.

@kjk
Last active December 10, 2021 05:26
Show Gist options
  • Save kjk/ca065f34cd03d9f8734f7fb1d147d58d to your computer and use it in GitHub Desktop.
Save kjk/ca065f34cd03d9f8734f7fb1d147d58d to your computer and use it in GitHub Desktop.
gomarkdown example for #216 (made with https://codeeval.dev)
package main
import (
"fmt"
"github.com/gomarkdown/markdown"
"github.com/gomarkdown/markdown/parser"
)
const md = `
- [level-1-b](#level-1)
- [level-2-a](#level-2)
- [level-3-a](#level-3-a)
- [level-2-b](#level-2)
`
func main() {
extensions := parser.CommonExtensions | parser.AutoHeadingIDs
parser := parser.NewWithExtensions(extensions)
html := markdown.ToHTML([]byte(md), parser, nil)
fmt.Printf("html:\n%s\n", string(html))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment