How to preserve whitespace indentation of text enclosed in HTML tags excluding the current indentation level of the tag in the document?

Indenting With Comments Since browsers ignore comments, you can use them to indent your pre tag contents. Solution <html> <body> <main> Here is my code with hack: <pre> <!– –>def some_function <!– –> return ‘Hello, World!’ <!– –>end </pre> Here is my code without hack: <pre> def some_function return ‘Hello, World!’ end </pre> </main> <body> … Read more