From 206c8bf13a230464b24cff7834f8bf16d69b374a Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sat, 18 Sep 2021 12:03:19 -0700 Subject: [PATCH] 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. --- tools/doc/html.mjs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/doc/html.mjs b/tools/doc/html.mjs index 298a82a7cf0ace..34431ad9d829b2 100644 --- a/tools/doc/html.mjs +++ b/tools/doc/html.mjs @@ -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 = '
' +
               '