Renders Wiki-like links in markdown-it. This is useful for making Markdown-based wikis.
Install this into your project:
npm --save install markdown-it-wikicustom
...and use it:
const wikilinks = require('markdown-it-wikicustom')(options)
const md = require('markdown-it')()
.use(wikilinks)
.render('Click [[Wiki Links|here]] to learn about [[/Wiki]] links.')
Output:
<p>Click <a href="Wiki-Links">here</a> to learn about <a href="Wiki">Wiki</a> links.</p>
Default: ``
The base URL for absolute wiki links.
const html = require('markdown-it')()
.use(require('markdown-it-wikicustom')({ baseURL: '/wiki/' }))
.render('[[Main Page]]')
// <p><a href="/wiki/Main-Page.html">Main Page</a></p>
Default: ``
The base URL for relative wiki links.
const html = require('markdown-it')()
.use(require('markdown-it-wikicustom')({ relativeBaseURL: '#', suffix: '' }))
.render('[[Main Page]]')
// <p><a href="#Main-Page">Main Page</a></p>
Default: false
Render all wiki links as absolute links.
Default: ``
Append this suffix to every URL.
const html = require('markdown-it')()
.use(require('markdown-it-wikicustom')({ uriSuffix: '.php', relativeBaseURL: './' }))
.render('[[Main Page]]')
// <p><a href="./Main-Page.php">Main Page</a></p>
Default: {}
An object containing HTML attributes to be applied to every link.
const attrs = {
'class': 'wikilink',
'rel': 'nofollow'
}
const html = require('markdown-it')()
.use(require('markdown-it-wikicustom')({ htmlAttributes: attrs }))
.render('[[Main Page]]')
// <p><a href="Main-Page" class="wikilink" rel="nofollow">Main Page</a></p>