mdit-plg-double-bracket-link
v0.0.2
Published
[![NPM version](https://img.shields.io/npm/v/mdit-plg-double-bracket-link?color=a1b858&label=)](https://www.npmjs.com/package/mdit-plg-double-bracket-link)
Downloads
4
Readme
mdit-plg-double-bracket-link
Parse [[path/to/page]]
into html in markdown-it!
Inspired by the combination usage between vite and Obsidian.
Twin plugin: mdit-plg-double-bracket-media
Probably for my personal blog...
Usage
pnpm i mdit-plg-double-bracket-link -D
// use this plugin in markdown-it
import DoubleBracketLink from 'mdit-plg-double-bracket-link'
md.use(DoubleBracketLink, {
/**
* (Optional) remove the prefix in the double brackets.
* It will parse ![[pages/path/to/file|target link]] into
* <a href="/path/to/file">target link</a>
*/
removePrefix: 'pages/',
/**
* (Optional) after removing the provided prefix,
* param `addPrefix` will be added to the front of url.
*
* For example, if the params are `{ removePrefix: 'pages/', addPrefix: 'src/' }`,
* then it will parse ![[pages/path/to/file|target link]] into
* <a href="/src/path/to/file">target link</a>
*/
addPrefix: '',
/**
* (Optional) Add suffix to uri
*/
uriSuffix: '.html'
})
License
MIT License © 2022 widcardw