lse,
            e4x: false,
            indent_empty_lines: false
          });
          console.log('Beautified HTML:', formattedHTML);
        } else {
          // Enhanced fallback formatter
          formattedHTML = manuallyFormatHTML(renderedHTML);
          console.log('Manually formatted HTML:', formattedHTML);
        }
      } catch (error) {
        console.error('Formatting error:', error);
        formattedHTML = manuallyFormatHTML(renderedHTML);
      }

      // Create a code element for Pr