broken runnable example of goldmark extension
parent
a932fdefc9
commit
9b72dac5c8
@ -0,0 +1,35 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
// "fmt"
|
||||
|
||||
ofm "code.ndumas.com/ndumas/obsidian-markdown/goldmark"
|
||||
"github.com/yuin/goldmark"
|
||||
"github.com/yuin/goldmark/parser"
|
||||
)
|
||||
|
||||
func main() {
|
||||
m := goldmark.New(goldmark.WithExtensions(
|
||||
ofm.ObsidianLinkExtension,
|
||||
))
|
||||
|
||||
source := `
|
||||
# Hello goldmark-extensions
|
||||
this is a [[wikilink]] in text
|
||||
|
||||
[[wikilink]] starting a line
|
||||
|
||||
ending a line with a [[wikilink]]
|
||||
`
|
||||
|
||||
var buf bytes.Buffer
|
||||
|
||||
context := parser.NewContext()
|
||||
|
||||
err := m.Convert([]byte(source), &buf, parser.WithContext(context))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
// fmt.Printf("%#+v\n", context)
|
||||
}
|
Loading…
Reference in New Issue