Skip to content

Parse and render wiki-style links in markdown especially Obsidian style links.

License

Notifications You must be signed in to change notification settings

datopian/remark-wiki-link-plus

Repository files navigation

🛑 This repository has been merged into Flowershow monorepo.

remark-wiki-link-plus

Parse and render wiki-style links in markdown especially Obsidian style links.

What is this ?

Using obsidian, when we type in wiki link syntax for eg. [[wiki_link]] it would parse them as anchors.

Features supported

  • Support [[Internal link]]
  • Support [[Internal link|With custom text]]
  • Support [[Internal link#heading]]
  • Support [[Internal link#heading|With custom text]]
  • Support ![[Document.pdf]]
  • Support ![[Image.png]]
  • Supported image formats are jpg, jpeg, png, apng, webp, gif, svg, bmp, ico
  • Unsupported image formats display a message for eg. ![[Image.xyz]] would render the following:
    Document type XYZ is not yet supported for transclusions

Future support:

  • Support ![[Audio.mp3]]
  • Support ![[Video.mp4]]
  • Support ![[Embed note]]
  • Support ![[Embed note#heading]]

Installation

npm install remark-wiki-link-plus

Usage

const unified = require('unified')
const markdown = require('remark-parse')
const wikiLinkPlugin = require('remark-wiki-link-plus');

let processor = unified()
    .use(markdown, { gfm: true })
    .use(wikiLinkPlugin)

Configuration options

  • options.markdownFolder [String]: A string that points to the content folder.

    The default hrefTemplate is:

(permalink) => `/${permalink}`

Running the tests

npm run test

Change Log

[1.1.1] - 2022-11-14

Fixed

  • Permalinks not linking to case sensitive url paths
    • eg. before [[Page]] generates href="/page" but will now generate href="/Page"

[1.1.0] - 2022-09-06

Added

  • Add support for more image formats
    • apng, webp, gif, svg, bmp, ico
  • Add support for PDF documents
  • Add warning for unsupported image formats

[1.0.2] - 2022-08-11

Added

  • Add support for transclusion links / image links
  • png, jpg, jpeg

[1.0.1] - 2022-08-04

Changed

  • permalink for folders with an index file will tranform to folder name only. For example, if the wikilink is [[docs/index]] the href will be '/docs'.

Fixed

  • broken links to filenames that matched the markdown folder name.

About

Parse and render wiki-style links in markdown especially Obsidian style links.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •