nodejs / node

Node.js JavaScript runtime ✨🐢🚀✨
https://nodejs.org
Other
104.76k stars 28.3k forks source link

tools: support rewriting links in code blocks #52938

Open crawford opened 1 month ago

crawford commented 1 month ago

Within the API documentation for modules, there is a section of pseudo-code which contains links to another file. This pseudo-code is inside of a pre-formatted element (<pre>), but that prevents the build process from rewriting those links from the Markdown source to their corresponding HTML output.

This addresses that by adding a new language, "pre", whose output remains unformatted but allows code fences to be annotated with metadata - code fences must have a language before the metadata. When the right metadata ("html") is present, it indicates that the code block should be processed so that anchor tags are rewritten just like other references.

The actual change to the documentation will happen in a later commit.

(This was split out from https://github.com/nodejs/node/pull/52883)

nodejs-github-bot commented 1 month ago

Review requested: