Author: AllenJB (AllenJB)
Committer: Derick Rethans (derickr)
Date: 2025-10-01T12:01:47+01:00

Commit: 
https://github.com/php/web-php/commit/9d3f87fffdc5de47e4647ff365fafb2e006b925b
Raw diff: 
https://github.com/php/web-php/commit/9d3f87fffdc5de47e4647ff365fafb2e006b925b.diff

interactive-examples.js: Enable for informal examples and fix output replacement

Changed paths:
  M  .editorconfig
  M  js/interactive-examples.js


Diff:

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 15aef1d8f0..7e67c952e3 100644
--- a/js/interactive-examples.js
+++ b/js/interactive-examples.js
@@ -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");
       }
     }
 

Reply via email to