From c8c00ae4853f4e50f69d75b89ee710b34169a798 Mon Sep 17 00:00:00 2001 From: Matthieu Riegler Date: Tue, 2 May 2023 20:30:43 +0200 Subject: [PATCH] docs(docs-infra): create code block for links to methods (#50110) Before this commit, links to methods had to rely on a custom title (or the method name would be displayed). With this commit, {@link MyClass#myMethod} will ouput a link as `MyClass#myMethod`. This has a 2nd advantage : We can now rely on the validation by the `checkAnchorLinksProcessor` to ensure the method actually exist. This commit is part of #50110 to improve linking in the documentation. PR Close #50110 --- aio/tools/transforms/links-package/services/getLinkInfo.js | 1 + 1 file changed, 1 insertion(+) diff --git a/aio/tools/transforms/links-package/services/getLinkInfo.js b/aio/tools/transforms/links-package/services/getLinkInfo.js index 7b9eb61237a..b365306bac5 100644 --- a/aio/tools/transforms/links-package/services/getLinkInfo.js +++ b/aio/tools/transforms/links-package/services/getLinkInfo.js @@ -49,6 +49,7 @@ module.exports = function getLinkInfo(getDocFromAlias, encodeCodeBlock, log) { } else if (url.indexOf('#') > 0) { var pathAndHash = url.split('#'); linkInfo = getLinkInfoImpl(pathAndHash[0], title, currentDoc); + linkInfo.title = encodeCodeBlock(pathAndHash.slice(-2).join('#'), true); linkInfo.url = linkInfo.url + '#' + pathAndHash[1]; return linkInfo;