Skip to content

Latest commit

 

History

History
70 lines (50 loc) · 1.54 KB

README.md

File metadata and controls

70 lines (50 loc) · 1.54 KB

goldmark-wikilink

goldmark-wikilink is an extension for the goldmark library that extends Markdown to support [[title]] Wikilink style links with a new AST type and HTML Renderer.

Demo

This markdown:

# Hello goldmark-wikilink

[[Example Link]]

Becomes this HTML, with the default Normalizer:

<h1>Hello goldmark-wikilink</h1>
<p><a href="Example%20Link.html">Example Link</a></p>

Installation

go get github.com/13rac1/goldmark-wikilink

Usage

  markdown := goldmark.New(
    goldmark.WithExtensions(
      wikilink.Extension,
    ),
  )
  var buf bytes.Buffer
  if err := markdown.Convert([]byte(source), &buf); err != nil {
    panic(err)
  }
  fmt.Print(buf)
}

TODO

  • Support Piped Links in the form [target|displayed text].
  • Support Section linking in the forms:
    • External link: [[Page name#Section name|displayed text]]
    • Internal link: [[#Section name|displayed text]]

License

MIT

Author

Brad Erickson & Kevin Dangoor

Fork of dangoor/goldmark-wikilinks. Adds a Wikilink AST type to ease extending and removes the WikilinkTracker which can implemented in a separate AST walker.