Skip to content

Commit da101ac

Browse files
Root identifier link tag support
1 parent 6a99265 commit da101ac

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

index.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -592,6 +592,23 @@ exports.astNodeVisitor = {
592592
);
593593
replace(typeRegex);
594594

595+
const linkWithoutTextRegex = new RegExp(
596+
`@(link (?!https?))${key}(\\.[^\\s\\}]*)*(\\s*\\})`,
597+
'g',
598+
);
599+
const linkWithTextRegex = new RegExp(
600+
`@(link (?!https?))${key}((?:\\.[^\\s\\}]*)*(?:\\s|\\s*\\|)[^\\}]*\\})`,
601+
'g',
602+
);
603+
604+
// If link is without text, use key as text
605+
comment.value = comment.value.replace(
606+
linkWithoutTextRegex,
607+
`@$1${key} ${key}$2$3`,
608+
);
609+
610+
replace(linkWithTextRegex);
611+
595612
function replace(regex) {
596613
if (regex.test(comment.value)) {
597614
const identifier = identifiers[key];

0 commit comments

Comments
 (0)