Skip to content

13rac1/goldmark-wikilink

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.