From eb6ea8501b3e7257addf5f795b73357bc5d8e3ba Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sat, 20 Mar 2021 07:21:36 -0700 Subject: [PATCH] doc,tools: use only one level 1 header per page Increment the header levels from markdown files when producing HTML documents. This is both better semantically (as the two h1 headers in current docs are not actually equivalent level semantically--the second belongs below/inside the first) and better for accessibility. (It is valid HTML to have multiple h1 headers in a document, but it can be bad for screen reader experience.) PR-URL: https://github.com/nodejs/node/pull/37839 Reviewed-By: Benjamin Gruenbaum Reviewed-By: James M Snell Reviewed-By: Pooja D P Reviewed-By: Antoine du Hamel --- test/doctool/test-doctool-html.js | 38 +++++++++++++++---------------- tools/doc/html.js | 17 ++++++++++---- 2 files changed, 32 insertions(+), 23 deletions(-) diff --git a/test/doctool/test-doctool-html.js b/test/doctool/test-doctool-html.js index 97c37dece88534..2fa4766c837a27 100644 --- a/test/doctool/test-doctool-html.js +++ b/test/doctool/test-doctool-html.js @@ -60,25 +60,25 @@ function toHTML({ input, filename, nodeVersion, versions }) { const testData = [ { file: fixtures.path('order_of_end_tags_5873.md'), - html: '

Static method: Buffer.from(array) ' + + html: '

Static method: Buffer.from(array) ' + '#

' + + 'id="foo_static_method_buffer_from_array">#

' + '' }, { file: fixtures.path('doc_with_yaml.md'), - html: '

Sample Markdown with YAML info' + + html: '

Sample Markdown with YAML info' + '#

' + - '

Foobar#

' + + ' id="foo_sample_markdown_with_yaml_info">#' + + '

Foobar#

' + ' ' + '

Describe Foobar in more detail here.

' + '
' + - '

Foobar II#