Skip to content

Use gitbook-plugin-include-codeblock#21

Merged
joyeecheung merged 3 commits intonodejs:mainfrom
joyeecheung:codeblocks
Apr 6, 2026
Merged

Use gitbook-plugin-include-codeblock#21
joyeecheung merged 3 commits intonodejs:mainfrom
joyeecheung:codeblocks

Conversation

@joyeecheung
Copy link
Copy Markdown
Member

This uses https://github.com/azu/gitbook-plugin-include-codeblock so that we can just reference snippets that will be rendered by honkit instead of creating inline copies of them in the document to reduce the risk of getting out of sync.

Compare the two versions (left is the current main, right is the PR):

Screenshot 2026-04-03 at 05 07 19

let a;
function runOnlyWhenUsed() {
a = require('./a.mjs');
//! [doc]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This block is closing before the function ends, is this intentional?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, I meant to just remove the log. Fixed.

@joyeecheung
Copy link
Copy Markdown
Member Author

joyeecheung commented Apr 6, 2026

@Aditi-1400 Thanks for catching the braces. I diffed the output again and I think it should be clean now. Rendering changes in the HTMLs summrized below:

  1. 03-multi-file-package/example/node_modules/my-logger/lib/utils.js: change object literal into multiple lines so we can abbreviate the properties using doxygen markers
  2. 03-multi-file-package/example/app.{mjs,cjs}: wrap the exceptions in a try-catch to demonstrate better in the docs
  3. 04-cjs-esm-interop/shipping-esm-for-cjs/cycle-lazy/b.cjs: real file has fixed indentation
  4. 04-cjs-esm-interop/shipping-esm-for-cjs/log-with-feature-detection.js: real file has more blank lines
  5. 05-cjs-esm-migration/migrating-imports/before|after/node_modules/my-module/initialize-plugin-*.js: real file has more blank lines
  6. 05-cjs-esm-migration/migrating-imports/after/node_modules/my-module/index.js: real file fixed the missing semicolon

@joyeecheung joyeecheung merged commit 01d632c into nodejs:main Apr 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants