diff --git a/tests/markdown-wikilink-renderer.test.js b/tests/markdown-wikilink-renderer.test.js index 09463a9..118b780 100644 --- a/tests/markdown-wikilink-renderer.test.js +++ b/tests/markdown-wikilink-renderer.test.js @@ -178,4 +178,32 @@ test('inline rule correctly displays unable to load embed content', t => { md.render('Hello world this is a ![[wiki-embed]]'), "

Hello world this is a [TESTING]

\n" ); +}); + +test('inline rule correctly displays anchor links', t => { + const wikilinkParser = new WikilinkParser(opts, new Set); + const compiledEmbeds = new Map; + + wikilinkParser.linkCache.set('[[wiki link#heading-id]]', { + title: 'Wiki Link', + href: '/wiki-link/', + anchor: 'heading-id', + isEmbed: false, + }); + + const md = require('markdown-it')({html: true}); + md.inline.ruler.push('inline_wikilink', wikilinkInlineRule( + wikilinkParser + )); + + md.renderer.rules.inline_wikilink = wikilinkRenderRule( + wikilinkParser, + compiledEmbeds, + opts + ); + + t.is( + "

Hello world, this is some text with a Wiki Link inside!

\n", + md.render('Hello world, this is some text with a [[wiki link#heading-id]] inside!', {}) + ); })