Git Product home page Git Product logo

goldmark-wikilink's Introduction

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.

goldmark-wikilink's People

Contributors

13rac1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

cutlerydrawer

goldmark-wikilink's Issues

Attributes not rendered

I'm using this extension to render backlinks in an Obsidian vault that I want to publish and it's working great. However backlinks to pages that do not exist yet (and I create a placeholder file for) I want to be able to render them differently.

I have been trying to set an attribute on those links but those don't seem to be rendered correctly by this extension, which I can see from the code.

https://github.com/13rac1/goldmark-wikilink/blob/master/wikilink.go#L167

Maybe goldmark's RenderAttributes can be utilized for this.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.