@@ -10,18 +10,6 @@ function createOutputSection() {
1010 ` ;
1111}
1212
13- function highlightJSON ( json ) {
14- if ( typeof json !== 'string' ) {
15- json = JSON . stringify ( json , null , 2 ) ;
16- }
17-
18- return json
19- . replace ( / ( " [ \w \s _ - ] + " ) ( \s * : ) / g, '<span class="json-key">$1</span>$2' )
20- . replace ( / : \s * ( " .* ?" ) / g, ': <span class="json-string">$1</span>' )
21- . replace ( / : \s * ( \d + \. ? \d * ) / g, ': <span class="json-number">$1</span>' )
22- . replace ( / : \s * ( t r u e | f a l s e ) / g, ': <span class="json-boolean">$1</span>' )
23- . replace ( / : \s * ( n u l l ) / g, ': <span class="json-null">$1</span>' ) ;
24- }
2513
2614function formatOutput ( data ) {
2715 if ( typeof data === 'string' ) {
@@ -40,7 +28,7 @@ function formatOutput(data) {
4028function displayOutput ( output ) {
4129 const target = document . querySelector ( '#standardOutput' ) ;
4230 if ( ! target ) return ;
43- target . innerHTML = highlightJSON ( formatOutput ( output ) ) ;
31+ target . textContent = formatOutput ( output ) ;
4432}
4533
4634function clearOutput ( ) {
@@ -74,14 +62,13 @@ function initializeOutput() {
7462 if ( standardOutput ) {
7563 const initialJSON = standardOutput . textContent ;
7664 if ( initialJSON . trim ( ) ) {
77- standardOutput . innerHTML = highlightJSON ( initialJSON ) ;
65+ standardOutput . textContent = initialJSON ;
7866 }
7967 }
8068}
8169
8270export {
8371 createOutputSection ,
84- highlightJSON ,
8572 displayOutput ,
8673 displayError ,
8774 clearError ,
0 commit comments