Controlling the layout of the code

There are three main features which let you control the layout of the code.

Element layout

Using Element layout in the Preferences submenu of the HTML menu, you can specify the layout you want for each HTML element. Alpha then uses your settings when it inserts new tags in the document, and when it otherwise reformats the code. The possible options differ between elements with and without a closing tag.

Elements without a closing tag

Layout

For elements without a closing tag you can specify if you always want a carriage return inserted before and/or after the tag. If you check both checkboxes in the dialog, Alpha will format the code like this:

some text before the tag
<TAG>
some text after the tag

Elements with a closing tag

Layout

For elements with a closing tag, you have four different options letting you specify if you want the tags to be on lines of their own and if you want blank lines before and after them.

With the first option Alpha will format the code like this:

some text before the tag <TAG>text between tags</TAG> some text after the tag

With the second option Alpha will format the code like this:

some text before the tag
<TAG>text between tags</TAG>
some text after the tag

With the third option Alpha will format the code like this:

some text before the tag

<TAG>text between tags</TAG>

some text after the tag

With the fourth option Alpha will format the code like this:

some text before the tag

<TAG>
text between tags
</TAG>

some text after the tag

Indentation

Alpha indents the HTML code to make easier to read. Using Indentation in the Preferences submenu, you can choose which elements whose content should be indented. By default the content of lists and tables is indented. The element which you can indent the content of are those with a closing tag, which you have specified the fourth layout above.

some text before the tag

<TAG>
text between tags
</TAG>

some text after the tag

Below is an example of how the code is indented. Whenever Alpha inserts new tags in the document or otherwise reformats the code, it recognizes your indentation preferences.

<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="5">
    
    <TR VALIGN="TOP">
        <TH ALIGN="LEFT">ELEMENT may not have a closing tag.</TH>
        <TD>A closing tag for an element which may not have one has been 
        found, like <SPAN CLASS="inlinecode">&lt;/BR&gt;</SPAN>.</TD>
    </TR>
    
</TABLE>

Formatting menu

Formatting menu
Reformat Paragraph
If there is a selection the code is reformatted within the selection, otherwise it is reformatted in the paragraph of the current position. A paragraph is in this case defined to be everything between the nearest blank lines.

Reformat Document
The same kind of reformatting of the whole document.

The reformatting is basically done such that the document would look as if you have typed it from top to bottom without changing anything. The following is done:

Unfortunately reformatting of the code is rather complex and therefore not lightning fast.

No Formatting
Insert formatting tags around the selected text indicating that the content between the tags should not be reformatted at all, but be left as it is. You can for example use this around server side scripting code, which Alpha has no special support for.

<!-- #NO-FORMATTING -->
some text which should left untouched
<!-- /#NO-FORMATTING -->

C Style Formatting
Insert formatting tags around the selected text indicating that the content between the tags should be formatted like C code. This is the same way as both JavaScript code and CSS code is formatted.
<!-- #C-FORMATTING -->
if (a == 17) {
    return;
}
<!-- /#C-FORMATTING -->

You can define your own formatting tags. See the power user section.

Previous page Next page