Less strict version of tidy, to indent html-like code?

Hello,
When using Copy as HTML in the DOM tree that Chrome's developer tools show, you get the whole thing as one single line (or a few. It is one line when copying a specific element, even if it has many nested elements inside of it). For looking at this, diffing it, and so on, it is of course way handier to have it as nicely indented HTML code instead.
I tried using tidy -i for this, but by default tidy is very strict. For example the fact that if you want to indent a sub section of an html page, there's no <html> tags is already a problem for tidy.
I tried the following way to solve the html tag problem:
tidy -xml -i file.txt
But then it sometimes outputs just a small part of the whole thing.
Basically, tidy seems not to work very well for semi-correct things that you just want to indent.
Does there exist a utility that's designed to indent any part of xml-like or html-like code into nice separate lines with indentation where possible, even if some tags might be missing or not closed or whatever? Or a command line flag of tidy that I might have missed
Thanks!
Last edited by aardwolf (2012-03-22 17:59:46)

You can try xmllint. (It's probably already installed on your system.  If not, it's part of libxml2 i.e. $ pacman -S libxml2)
$ xmllint --format in.html >out.html

Similar Messages

  • In my Mac Mail Version 4.5, I am not received email pdf attachement. It is shown in some html like form in message content. Please help

    In my Mac Mail Version 4.5, I am not received email pdf attachement. It is shown in some html like form in message content. Please help

    Erdygirl please be aware you are posting to a public forum.  I have removed your personal information from your previous post.
    Please check your account at http://www.adobe.com/ to locate your serial number.  You can find more information on how to locate your serial number at Find your serial number quickly - http://helpx.adobe.com/x-productkb/global/find-serial-number.html.

  • Are we allowed to use the Web developer function in Firefox version 5.0 to edit the html source code associated with the Firefox home page?

    Locking at request of OP - https://support.mozilla.com/en-US/questions/844506
    Are we allowed to use the Web developer function, under the "Firefox" tab in Firefox version 5.0, to edit the html source code associated with the Firefox version 5.0 home page ( so that we can personalize the home page )? Is this legal?
    Sincerely in Christ,
    Russell E. Willis

    Solution: (Free Download Manager)
    Go here: http://codecpack.co/download/Free_Download_Manager.html and download Free Download Manager 3.8.1067 Beta 3, it works perfectly with Firefox 5.0.1
    Solution: (to Google mail aka Gmail)
    I have had this problem for a while since I did a previous Firefox update, where I had to force Gmail to load in Basic HTML else it's next to impossible to use it. The solution is this: simply update your Java, and Gmail will work without a problem using Standard HTML. To update your Java go here: http://www.java.com/en/ and select "Free Java Download".
    And beta normally, universally, means "the not quite there yet version of the version we're aiming for" NORMALLY used during production and testing of a type of software.

  • Well indented html code in DW

    hi,
    i use DW8 and i recently found out that DW does not make a
    well indented HTML code. earlier i ignored this. this problem
    surfaced recently when the asp programmers using visual studio said
    that every time i give them a html page, they have to indent it
    properly so that they are able to code properly which results in
    some time being wasted. why is that DW cannot write proper indented
    html code in the first place? will this be fixed in future or this
    will continue? is there any extension which i can use to properly
    indent it?
    thanks,
    gaurav

    gaurav_ch wrote:
    > fiddled around some more and found out that indeed there
    is a command -
    > commands>apply source formatting. but then another
    question - why do i have to
    > do it myself, why not by default?
    Some people don't like indented code formatting.
    James M. Shook
    http://www.jshook.com

  • Upgraded to 11.3.1 now can't open library. Won't read. I have an older iMac (2008). Message I get is: cannot be read because was created by newer version of iTunes. Would you like to download iTunes now?' ... so I do and it fixes nothing. OS 10.6.8

    Upgraded to 11.3.1 now can't open library. Won't read. I have an older iMac (2008). Message I get is: cannot be read because was created by newer version of iTunes. Would you like to download iTunes now?' ... so I do and it fixes nothing. Same message again. OS is 10.6.8.

    Thanks again. The option thing got me further than I've gotten thus far but when I went to choose a library I got that same message.
    I do have options. I have 2 iMacs. I can still access my music through 'sharing' and download it onto my newer iMac. Trouble is it doesn't have a CD port and I like to burn. From what I've read about their new Mac portable CD/DVD drive, it's shaky at best. Incidentally, do you know of any drives that work well with Macs and cost less than $89.00?
    I've figured out I can download a previous library from my old Mac then upload it from the new one which should put me back in business, but what do I do with the corrupt one that's there now, just trash it? Also, when I do the option key my other choice is Create A New Library. Should I do that and put the good previous library into it?
    Thanks a million, I really appreciate your time. I'm an old fogey and computers often mystify me, especially when they lock me out of things for no apparent reason.

  • I see the license agreement as HTML source code

    Hello,
    I downloaded a trial version of Adobe Acrobat 9.0,
    but after I had installed it and start it, it wants me to agree on the license agreement.
    but my problem is that I can't click on Agree nor Disagree because I see only HTML source code
    see the printscreen I added below.
    does anyone know what is wrong, or wat I have to install to 'use' these HTML pages whitin Adobe Acrobat?
    I also downloaded the software again and installed it again and it happens also with trial versions of photoshop,
    I have not tested other software so far.
    Thanks in advance
    Kees
    PS: I am dutch so my english is not perfect.

    You seem to have missed this thread:
    http://www.adobeforums.com/webx/.3bc424c7/
    I understand Liam's suggestion has worked for many.

  • Anyway to prevent html quick code

    anyway to prevent html quick code to arrive in a text item
    When i fetch a value which contains & it gets converted to amp & which is html quick code
    any idea to prevent this from happening will be appreciated
    Version apex 4.2 db 11g release 2
    Thanks

    There's no such thing as an "HTML quick code". Using non-standard terminology is simply confusing, as is posting duplicate threads:
    <li>+{thread:id=2482368}+
    <li>+{thread:id=2483005}+
    Close this thread and stick to the original one.

  • Latest plug-in html referring code

    The following code sends someone, who does not have the java plug-in installed, to download plug-in 1.3 . My question is what changes do I have to make to the code so that it will send the visitor to download the latest plug-in: 1.4.2_03 .
    Thank you in advance for your help !
    <html>
    <head>
    </head>
    <body>
    <OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
    WIDTH = "700" HEIGHT = "300"
    codebase="http://java.sun.com/products/plugin/1.3/jinstall-13-win32.cab#Version=1,3,0,0">
    <PARAM NAME = CODE VALUE = "Myclass.class">
    <PARAM NAME = ARCHIVE VALUE = "Myjar.jar">
    <PARAM NAME="type" VALUE="application/x-java-applet;version=1.3">
    <PARAM NAME="scriptable" VALUE="false">
    <PARAM name="progressbar" value="true">
    </OBJECT>
    </body>
    </html>

    In Reply 1, I've given a value for the codebase that previously led to the version 1.4.2 of the plugin. At the time, I had assumed that this codebase directed to the most recent version of the plugin.
    But today I noticed that this codebase value was directing to download the version 1.4.1_03 of the plugin. So I must retract my claim that this codebase leads to the most recent version. It may not.
    As provided by a relatively recent execution of the html converter, currently the client will be directed to the version 1.4.2_03 if the following codebase is used..
    http://java.sun.com/update/1.4.2/jinstall-1_4-windows-i586.cab#Version=1,4,0,0
    or this
    http://java.sun.com/products/plugin/autodl/jinstall-1_4_2-windows-i586.cab#Version=1,4"
    But is this simply the most recent of 1.4.2 or the most recent of all? When java has produced 1.6 will this codebase be resulting in the download of 1.4.2?
    I'm interested to learn what value of codebase will always be pointing to the most recent stable release of the java plugin, in the event that the client must download a plugin to view an applet. And if there is no direction to the most recent version overall, I'd like to be informed of that as well.
    Thanks so much.

  • HTML 5 code having a jquery slider is working in safari 4 (also other browsers). Its not working in safari 5.

    HTML 5 code having a jquery slider function is working in safari 4. It is also working in IE9, IE8, Firefox 13. In Safari 5, it is not loading. Also CSS is not loading correctly. Its showing failed to load 

    HTML 5 code having a jquery slider function is working in safari 4. It is also working in IE9, IE8, Firefox 13. In Safari 5, it is not loading. Also CSS is not loading correctly. Its showing failed to load 

  • I have just updated my Facebook app to version 11.0 - and don't like it - is there anyway for me to get back the previous app - I think it was 6.0 but not positive -

    I Have just updated my iphone 5 Facebook app, to version 11.0 and do not like it. Is it possible for me to go back to my previous version?

    Okay, I found the answer myself. Going to about:config and setting browser.showQuitWarning to true, restored that option and brought it back. Thanks to anyone who is about to post. If this is false by default, it has got to change.
    -- Sorcus

  • How do I replace image color with an exact html color code?

    I simply want to change the color of a small pic to an existing html color code, 3399CC.  The pic is very simple, and only has one color.  In Photoshop CS4, I go to:  Image -> Adjustments -> Replace Color.  For the new replacement color, when I type in 3399CC, it doesn't give me that color - it gives some other shade of that color.  (I can tell because I use a program that tells me the exact html code a color is when I hover my mouse over it).  It seems the only way to really get the color you want is to adjust the sliders (hue, saturation, and lightness).  But it'd be practically impossible to play around with every increment of those sliders until I get the exact color code.  
    There's got to be a way to simply enter the html color code and have the pic changed to that color.  Does anyone have any idea?

    Turns key.  WhirrRRRrrrrRRRrrrr....  Nothing.  (I answered in the other thread)
    Perhaps I've had too much coffee today, because I just got a clear vision of Bart Simpson, at the board, chalk in hand...
    SRGB IS KING!!!  SRGB IS DEAD!!!  LONG LIVE SRGB!!!
    SRGB IS KING!!!  SRGB IS DEAD!!!  LONG LIVE SRGB!!!
    SRGB IS KING!!!  SRGB IS DEAD!!!  LONG LIVE SRGB!!!
    SRGB IS KING!!!  SRGB IS DEAD!!!  LONG LIVE SRGB!!!
    SRGB IS KING!!!  SRGB IS DEAD!!!  LONG LIVE SRGB!!!
    SRGB IS KING!!!  SRGB IS DEAD!!!  LONG LIVE SRGB!!!
    -Noel

  • I cannot open iTunes.  I get a message that says "The file iTunes library.itl cannot be read because it was created by a newer version of iTunes. Would you like to download iTunes now?"  I downloaded it and it and I continue to get the same message.  How

    I cannot open iTunes.  I get a message that says "The file iTunes library.itl cannot be read because it was created by a newer version of iTunes. Would you like to download iTunes now?"
    I downloaded it and it and I continue to get the same message.
    How do I fix this?    Thanks,  Dee

    Upgrade iTunes to the latest version. It should be 10.5.3.

  • When i try to open itunes on my mac a message comes up saying The file "iTunes Library" cannot be read because it was created by a newer version of iTunes. Would you like to download iTunes now?"

    When i try to open itunes, a message pops up saying "The file “iTunes Library” cannot be read because it was created by a newer version of iTunes. Would you like to download iTunes now?." I have tried downloading the newest version of itunes but it still won't open. What should i do?

    Update your copy of itunes to the current version.

  • TS1627 I cannot open iTunes. This is the message I get:  "The file iTunes library .itl cannot be read because it was created by a newer version of iTunes. Would you like to download iTunes now?"  I did a download and it is up to date, but still won't open

    I cannot open iTunes. This is the message I get:  "The file iTunes library .itl cannot be read because it was created by a newer version of iTunes. Would you like to download iTunes now?"  I did a download and it is up to date, but still won't open.  HELP

    See Empty/corrupt iTunes library after upgrade/crash.
    tt2

  • I receive the message: The file "iTunes Library.itl" cannot be read because it was created by a newer version of iTunes. Would you like to download iTunes now?

    I receive the message:
    The file "iTunes Library.itl" cannot be read because it was created by a newer version of iTunes. Would you like to download iTunes now?
    I've ALREADY downloaded AND installed the new iTunes.
    ITunes WILL NOT launch.

    Hello, hillbent. 
    Thank you for the question.  If you have verified that iTunes 11.1 is installed, you will need to rebuild your iTunes library file.  Below, I have included the article that walks you through this process.  Start with the section labeled Re-creating the iTunes Library file.
    iTunes: How to re-create your iTunes library and playlists
    http://support.apple.com/kb/ht1451
    Cheers,
    Jason H.

Maybe you are looking for