Support relativePath link set linkTarget
Hi When I read the docs of "Set target attribute for link" https://docsify.js.org/#/helpers?id=set-target-attribute-for-link I try a relative path to jump
[demo](/docs/front_end/summery_of_experience/data_use/assets/demo/index.html ':target=_blank')
but It be compiled as
<a href="/docs/front_end/summery_of_experience/data_use/assets/demo/index.html">demo</a>
It is not my expectation.
After then, I read the source code: "src\core\render\compiler\link.js" line 22
I discover that docsifyjs didnt support relative path linkTarget custom
so I make the issue in order to discuss the problem
thx
"src\core\render\compiler\link.js" line 22
if (
!isAbsolutePath(href) && // If it is relative path, then cant set linkTarget
!compilerClass._matchNotCompileLink(href) &&
!config.ignore
) {
if (href === compilerClass.config.homepage) {
href = 'README';
}
href = router.toURL(href, null, router.getCurrentPath());
} else {
if (!isAbsolutePath(href) && href.slice(0, 2) === './') {
href =
document.URL.replace(/\/(?!.*\/).*/, '/').replace('#/./', '') + href;
}
attrs.push(href.indexOf('mailto:') === 0 ? '' : `target="${linkTarget}"`);
attrs.push(
href.indexOf('mailto:') === 0
? ''
: linkRel !== ''
? ` rel="${linkRel}"`
: ''
);
}
Thx for ur report. Unfortunately, docsify doesn't support the relative target config for now. I think we may have an update on it asap. :)
Okay, thx ur reply and support I can use the absolute link instead now. hope you have a nice day :)