Skip to content

Some anchor links aren't working #62403

@Botato300

Description

@Botato300

Affected URLS

Problem

Those links refer to an HTML element with the ID __dirname or __filename instead of using the IDs without the underscores, because when the documentation content is generated, it appears to remove the underscores and generates IDs without underscores. You can find those links on this page: https://nodejs.org/docs/latest/api/globals.html#global-objects

The modules.md file also references __dirname and __filename several times, so this page also contains broken anchor links: https://nodejs.org/docs/latest/api/modules.html

Possible Cause

I think the problem is related to this: https://github.com/nodejs/doc-kit/blob/d9697c7fbbbddeca58f9dc71693d4af9774455e0/src/generators/metadata/constants.mjs#L12

I was thinking about changing the link in the files listed below, but I think that would break the link (at least in GitHub's Markdown editor), so that wouldn't be a good solution.

node/doc/api/globals.md

Lines 14 to 30 in 61102cd

* [`__dirname`][]
* [`__filename`][]
* [`exports`][]
* [`module`][]
* [`require()`][]
The objects listed here are specific to Node.js. There are [built-in objects][]
that are part of the JavaScript language itself, which are also globally
accessible.
## `__dirname`
This variable may appear to be global but is not. See [`__dirname`][].
## `__filename`
This variable may appear to be global but is not. See [`__filename`][].

Metadata

Metadata

Assignees

No one assigned

    Labels

    docIssues and PRs related to the documentations.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions