Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 590ace4

Browse filesBrowse files
TrottBethGriggs
authored andcommitted
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: #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>
1 parent a07d844 commit 590ace4
Copy full SHA for 590ace4

File tree

Expand file treeCollapse file tree

1 file changed

+2
-1
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+2
-1
lines changed
Open diff view settings
Collapse file

‎tools/doc/html.mjs‎

Copy file name to clipboardExpand all lines: tools/doc/html.mjs
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,8 @@ export function preprocessElements({ filename }) {
227227
nextNode.lang !== node.lang) {
228228
// Saving the highlight code as value to be added in the next node.
229229
node.value = highlighted;
230-
} else if (isJSFlavorSnippet(previousNode)) {
230+
} else if (isJSFlavorSnippet(previousNode) &&
231+
previousNode.lang !== node.lang) {
231232
node.value = '<pre>' +
232233
'<input class="js-flavor-selector" type="checkbox"' +
233234
// If CJS comes in second, ESM should display by default.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.