Add #tag "#" on links

This commit is contained in:
Peter Stuifzand 2021-10-29 22:14:56 +02:00
parent 70f1b62646
commit b63eb7948f
2 changed files with 5 additions and 1 deletions

View File

@ -67,7 +67,7 @@ Plugin.prototype.render = function (tokens, id, options, env) {
return '<input type="checkbox" class="checkbox" checked>';
}
}
return '<a href="/' + link.replace(' ', '_') + '" class="wiki-link">' + link + '</a>';
return '<a href="/' + link.replace(' ', '_') + '" class="wiki-link">' + (tag ? '#' : '') + link + '</a>';
}
export default (options) => {

View File

@ -59,4 +59,8 @@ describe('MD', function () {
it('parseLinks 6', function () {
assert.deepStrictEqual(MD.renderInline("test [[test]] [[test2]]"), 'test <a href="/test" class="wiki-link">test</a> <a href="/test2" class="wiki-link">test2</a>')
})
it('parseLinks tag', function () {
assert.deepStrictEqual(MD.renderInline("test #[[test]]"), 'test <a href="/test" class="wiki-link">#test</a>')
})
})