Skip to content

Commit

Permalink
feat: Option to let user define position of term hint (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
about-code committed Oct 1, 2019
1 parent 916dd9d commit 0569652
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/linker.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,13 @@ function linkify(termDefs, txtNode, context, file) {
let txtNode_ = linkifyRegex(term.regex, term, (linkNode) => {
linkNode.title = term.getShortDescription();
linkNode.url = getTermUrl(context, term, file);
linkNode.children[0].value += hasMultipleDefs ? "" : (term.hint || "");
if (!hasMultipleDefs && term.hint) {
if (/\$\{term\}/.test(term.hint)) {
linkNode.children[0].value = term.hint.replace("${term}", linkNode.children[0].value);
} else {
linkNode.children[0].value += term.hint;
}
}
linkNode_ = linkNode;
return linkNode;
})()(txtNode);
Expand Down

0 comments on commit 0569652

Please sign in to comment.