Tidy rendered HTML output in Chrome's View Source?

4

3

More often than not when using things like CMS'es and static site generators, HTML output looks like rubbish (wrong indendation being the most annoying flaw).

Is there any solution for having rendered output in Chrome's "View Source" tidied / prettified?

In my case I'm using a static site generator. Everything looks perfect in the editor but code gets screwed when previewing in the browser.

(I know I can probably add a build task (e.g. Grunt) to handle HTML-prettifying. But in many cases, such as when using live-reload tools (I'm using Mixture.io) where you actually preview an internal version of the site, that's not an optimal solution.)

Henrik

Posted 2013-11-06T10:50:08.027

Reputation: 495

Answers

5

I recommend Quick Source Viewer.
It can show you the source of the current page formatted and colour coded.

It's pretty powerful, showing all 'sources' of the page, be it css, js or html. Even things like inline css/js can be viewed individually (with injected code highlighted). And the best part is it prettifies all of them, even the css (which chrome's dev tools still refuses to do).

Hashbrown

Posted 2013-11-06T10:50:08.027

Reputation: 1 720

Still works in 2017 :) – Dimitry K – 2017-07-26T16:56:21.390

I haven't had to use it in a while, devtools have come a long way, css pretty-prints now, but I'm glad it still works, it's really powerful – Hashbrown – 2017-07-27T01:26:24.993

Chrome doesn't allow the extension to operate on a tab whose address starts with view-source: (ie. a tab created after the user selects View Page Source). – chb – 2018-01-20T17:44:58.107

2Thanks! That's a great recommendation, I'll be using it. If only it was integrated within DevTools to prevent having it in a separate window and manually refreshing upon changes … :) – Henrik – 2013-11-15T09:33:38.137

0

I usually just Ctrl+Shift+I for Inspect. The Elements tab has all the html, with clor coding and hide-unhide for sections.

jon

Posted 2013-11-06T10:50:08.027

Reputation: 1