Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Dec 2011
    Posts
    41
    Thanks
    14
    Thanked 0 Times in 0 Posts

    Is there a source code beautifier by Javascript?

    Assume I have (in e.g. a <textarea>....</textarea> or <pre>...</pre> Element)
    a source code of Javascript itself or Java or XML or C++ or whatever.

    I want to present this NOT pre-beautified source code in a better readable way to the user of the web page. That mean mostly having indented lines depending of the bracket hierarchy of the source code statement.

    Is there a function in Javascript which let me automatically do these
    beautifying job and insert e.g. necessary "&nbsp;" ot tab for the indention?

    I could imagine that there is a function

    textarea.autoindent();

    or something similar.

    Maybe one has to use a 3rd party library like jQuery.

    Peter

  • #2
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,676
    Thanks
    6
    Thanked 1,008 Times in 981 Posts
    A quick internet search brought this: http://www.webdesignbooth.com/9-usef...hting-scripts/

  • #3
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,346
    Thanks
    11
    Thanked 589 Times in 570 Posts
    http://danml.com/slim lets you format JS, CSS (several ways), and html code.
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/5/28) IE7:0.1, IE8:5.3, IE11:8.4, IE9:3.2, IE10:3.2, FF:18.2, CH:46, SF:7.9, NON-MOUSE:32%


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •