Skip to content

A Wikilink extension for the goldmark markdown parser.

License

Notifications You must be signed in to change notification settings

cutlerydrawer/goldmark-wikilink

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 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.

About

A Wikilink extension for the goldmark markdown parser.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 100.0%