mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
tools,doc: fix misrendering of consecutive JS blocks
Our markdown-to-html tool was assuming that any consecutive JS blocks were ESM vs CJS alternatives, but that is not always the case, resulting in both a confusing interface and invalid HTML. PR-URL: https://github.com/nodejs/node/pull/40146 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
This commit is contained in:
parent
0bafe6dd21
commit
b0d5eecdd9
@ -227,7 +227,8 @@ export function preprocessElements({ filename }) {
|
||||
nextNode.lang !== node.lang) {
|
||||
// Saving the highlight code as value to be added in the next node.
|
||||
node.value = highlighted;
|
||||
} else if (isJSFlavorSnippet(previousNode)) {
|
||||
} else if (isJSFlavorSnippet(previousNode) &&
|
||||
previousNode.lang !== node.lang) {
|
||||
node.value = '<pre>' +
|
||||
'<input class="js-flavor-selector" type="checkbox"' +
|
||||
// If CJS comes in second, ESM should display by default.
|
||||
|
Loading…
Reference in New Issue
Block a user