Skip to content

Commit 1ef2cf8

Browse files
foxxyzdanielleadams
authored andcommittedOct 12, 2021
doc: anchor link parity between markdown and html-generated docs
Main changes: - Replace current HTML anchor generation to match header anchor generation in Github markdown. - Remove unnecessary double namespacing on generated anchors/links (E.G. `esm.md#loaders` instead of `esm.md#esm_loaders`). - Anchors/links are automatically prefixed with their respective modules when concatenated for usage in `all.html`. Benefits: - All anchor links within and between markdown API docs actually work. - Adding new anchor links no longer requires contributors to generate the HTML docs first to look up the correct anchors. - Anchors are much shorter. - All previous anchor links are preserved by generating hidden legacy anchors. PR-URL: #39304 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
1 parent 6d80a5e commit 1ef2cf8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+1498
-1435
lines changed
 

‎doc/api/addons.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ in the Node-API are used.
457457

458458
Creating and maintaining an addon that benefits from the ABI stability
459459
provided by Node-API carries with it certain
460-
[implementation considerations](n-api.md#n_api_implications_of_abi_stability).
460+
[implementation considerations][].
461461

462462
To use Node-API in the above "Hello world" example, replace the content of
463463
`hello.cc` with the following. All other instructions remain the same.
@@ -1367,15 +1367,16 @@ console.log(result);
13671367

13681368
[Electron]: https://electronjs.org/
13691369
[Embedder's Guide]: https://github.com/v8/v8/wiki/Embedder's%20Guide
1370-
[Linking to libraries included with Node.js]: #addons_linking_to_libraries_included_with_node_js
1370+
[Linking to libraries included with Node.js]: #linking-to-libraries-included-with-nodejs
13711371
[Native Abstractions for Node.js]: https://github.com/nodejs/nan
13721372
[V8]: https://v8.dev/
1373-
[`Worker`]: worker_threads.md#worker_threads_class_worker
1373+
[`Worker`]: worker_threads.md#class-worker
13741374
[bindings]: https://github.com/TooTallNate/node-bindings
13751375
[download]: https://github.com/nodejs/node-addon-examples
13761376
[examples]: https://github.com/nodejs/nan/tree/HEAD/examples/
1377+
[implementation considerations]: n-api.md#implications-of-abi-stability
13771378
[installation instructions]: https://github.com/nodejs/node-gyp#installation
13781379
[libuv]: https://github.com/libuv/libuv
13791380
[node-gyp]: https://github.com/nodejs/node-gyp
1380-
[require]: modules.md#modules_require_id
1381+
[require]: modules.md#requireid
13811382
[v8-docs]: https://v8docs.nodesource.com/

‎doc/api/assert.md

+23-22
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ assert.deepEqual([[[1, 2, 3]], 4, 5], [[[1, 2, '3']], 4, 5]);
9999
To deactivate the colors, use the `NO_COLOR` or `NODE_DISABLE_COLORS`
100100
environment variables. This will also deactivate the colors in the REPL. For
101101
more on color support in terminal environments, read the tty
102-
[getColorDepth()](tty.md#tty_writestream_getcolordepth_env) documentation.
102+
[`getColorDepth()`][] documentation.
103103

104104
## Legacy assertion mode
105105

@@ -2420,34 +2420,35 @@ argument.
24202420
[Object.prototype.toString()]: https://tc39.github.io/ecma262/#sec-object.prototype.tostring
24212421
[SameValue Comparison]: https://tc39.github.io/ecma262/#sec-samevalue
24222422
[Strict Equality Comparison]: https://tc39.github.io/ecma262/#sec-strict-equality-comparison
2423-
[`AssertionError`]: #assert_class_assert_assertionerror
2424-
[`CallTracker`]: #assert_class_assert_calltracker
2423+
[`AssertionError`]: #class-assertassertionerror
2424+
[`CallTracker`]: #class-assertcalltracker
24252425
[`Class`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes
2426-
[`ERR_INVALID_RETURN_VALUE`]: errors.md#errors_err_invalid_return_value
2427-
[`Error.captureStackTrace`]: errors.md#errors_error_capturestacktrace_targetobject_constructoropt
2428-
[`Error`]: errors.md#errors_class_error
2426+
[`ERR_INVALID_RETURN_VALUE`]: errors.md#err_invalid_return_value
2427+
[`Error.captureStackTrace`]: errors.md#errorcapturestacktracetargetobject-constructoropt
2428+
[`Error`]: errors.md#class-error
24292429
[`Map`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map
24302430
[`Object.is()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
24312431
[`RegExp`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions
24322432
[`Set`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set
24332433
[`Symbol`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol
2434-
[`TypeError`]: errors.md#errors_class_typeerror
2434+
[`TypeError`]: errors.md#class-typeerror
24352435
[`WeakMap`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap
24362436
[`WeakSet`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakSet
2437-
[`assert.deepEqual()`]: #assert_assert_deepequal_actual_expected_message
2438-
[`assert.deepStrictEqual()`]: #assert_assert_deepstrictequal_actual_expected_message
2439-
[`assert.doesNotThrow()`]: #assert_assert_doesnotthrow_fn_error_message
2440-
[`assert.equal()`]: #assert_assert_equal_actual_expected_message
2441-
[`assert.notDeepEqual()`]: #assert_assert_notdeepequal_actual_expected_message
2442-
[`assert.notDeepStrictEqual()`]: #assert_assert_notdeepstrictequal_actual_expected_message
2443-
[`assert.notEqual()`]: #assert_assert_notequal_actual_expected_message
2444-
[`assert.notStrictEqual()`]: #assert_assert_notstrictequal_actual_expected_message
2445-
[`assert.ok()`]: #assert_assert_ok_value_message
2446-
[`assert.strictEqual()`]: #assert_assert_strictequal_actual_expected_message
2447-
[`assert.throws()`]: #assert_assert_throws_fn_error_message
2448-
[`process.on('exit')`]: process.md#process_event_exit
2449-
[`tracker.calls()`]: #assert_tracker_calls_fn_exact
2450-
[`tracker.verify()`]: #assert_tracker_verify
2437+
[`assert.deepEqual()`]: #assertdeepequalactual-expected-message
2438+
[`assert.deepStrictEqual()`]: #assertdeepstrictequalactual-expected-message
2439+
[`assert.doesNotThrow()`]: #assertdoesnotthrowfn-error-message
2440+
[`assert.equal()`]: #assertequalactual-expected-message
2441+
[`assert.notDeepEqual()`]: #assertnotdeepequalactual-expected-message
2442+
[`assert.notDeepStrictEqual()`]: #assertnotdeepstrictequalactual-expected-message
2443+
[`assert.notEqual()`]: #assertnotequalactual-expected-message
2444+
[`assert.notStrictEqual()`]: #assertnotstrictequalactual-expected-message
2445+
[`assert.ok()`]: #assertokvalue-message
2446+
[`assert.strictEqual()`]: #assertstrictequalactual-expected-message
2447+
[`assert.throws()`]: #assertthrowsfn-error-message
2448+
[`getColorDepth()`]: tty.md#writestreamgetcolordepthenv
2449+
[`process.on('exit')`]: process.md#event-exit
2450+
[`tracker.calls()`]: #trackercallsfn-exact
2451+
[`tracker.verify()`]: #trackerverify
24512452
[enumerable "own" properties]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Enumerability_and_ownership_of_properties
24522453
[prototype-spec]: https://tc39.github.io/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots
2453-
[strict assertion mode]: #assert_strict_assertion_mode
2454+
[strict assertion mode]: #strict-assertion-mode

0 commit comments

Comments
 (0)
Please sign in to comment.