diff --git a/.editorconfig b/.editorconfig index b6249fbb09..96497cb17d 100644 --- a/.editorconfig +++ b/.editorconfig @@ -5,6 +5,10 @@ charset = utf-8 insert_final_newline = true trim_trailing_whitespace = true +[*.js] +indent_size = 2 +indent_style = space + [*.yaml] indent_size = 2 indent_style = space diff --git a/js/interactive-examples.js b/js/interactive-examples.js index fbf662c2f0..7e67c952e3 100644 --- a/js/interactive-examples.js +++ b/js/interactive-examples.js @@ -60,7 +60,7 @@ class PHP { async function main() { let lastOutput = null; - document.querySelectorAll(".example .example-contents").forEach((example) => { + document.querySelectorAll(".example .example-contents, .informalexample .example-contents").forEach((example) => { const button = document.createElement("button"); button.setAttribute("type", "button"); const phpcode = example.querySelector(".phpcode.annotation-interactive"); @@ -72,10 +72,14 @@ async function main() { let exampleTitleParagraphElement = null; let exampleScreenPreElement = null; if (exampleTitleContainer !== null) { - exampleTitleParagraphElement = exampleTitleContainer.querySelector("p") + if (exampleTitleContainer.tagName === "P") { + exampleTitleParagraphElement = exampleTitleContainer; + } else { + exampleTitleParagraphElement = exampleTitleContainer.querySelector("p") + } const exampleScreenContainer = exampleTitleContainer.nextElementSibling; if (exampleScreenContainer !== null) { - exampleScreenPreElement = exampleScreenContainer.querySelector("pre"); + exampleScreenPreElement = exampleScreenContainer.querySelector("pre"); } }