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
This commit is contained in:
Matthieu Riegler
2023-05-02 20:30:43 +02:00
committed by Pawel Kozlowski
parent 1ad4d55d91
commit c8c00ae485
@@ -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;