${highlighted}
`); newWindow.document.close(); } else { alert("Pop-up blocked! Please allow pop-ups for this feature to work."); } } function formatHTML() { const code = editor.getValue(); const formatted = html_beautify(code, { indent_size: 2, wrap_line_length: 80 }); editor.setValue(formatted, -1); } function expandAll() { editor.session.unfold(); } function collapseAll() { editor.session.foldAll(); } function loadSample() { const sample = ` Sample Page

Welcome to Spectacular HTML Viewer!

This is a sample page to demonstrate the editor's capabilities.

This is a nested element demonstrating folding.

`; editor.setValue(sample, -1); editor.gotoLine(1); } function clearEditor() { editor.setValue(""); } // Keyboard shortcuts for quick access to functions document.addEventListener("keydown", (e) => { if (e.altKey) { e.preventDefault(); switch (e.key) { case "1": openNewTabPreview(); break; case "2": highlightInNewTab(); break; case "3": formatHTML(); break; case "4": expandAll(); break; case "5": collapseAll(); break; case "6": loadSample(); break; case "7": clearEditor(); break; } } });