Formatting HTML source display

Source view allows you to format your HTML source code for readability. This feature enables you to specify your own HTML source formatting rules. It overrides the default formatting that the editor applies when you edit a file in Page view or use a tool or menu item to generate code in Source view.

Why use HTML source formatting

This feature is important if you use Page view to develop or modify your HTML files. Page view edits your HTML source code behind the scenes, then formats that code according to its own rules for indenting, new lines, and so on. Although this default formatting is generally adequate, it might differ from the coding style you want.

Source formatting options enable you to override the default formatting generated from Page view with your own code formatting rules.

Invoking HTML source formatting

If you select the Format Source option (on the Editors tab of the Options Properties dialog box), PowerBuilder automatically performs HTML source formatting in these cases:

Whether or not you check the Format Source option, you can invoke HTML source formatting manually at any time by selecting the Format Source command on the Source view pop-up menu.

Preserving your own source formatting

If you prefer to format your HTML source code manually and keep it in that format, use Source view instead of Page view for all your editing, and do not select the Format Source command from the Source view pop-up menu.

StepsTo change the Source view display formatting:

  1. Select Design>Options.

    The Options Properties dialog box opens to the Editors page.

  2. In the Windows list, highlight Source View.

    Select the Format Source check box.

    Type or select other options in the Editors panel.

  3. Select an HTML tag or Script tag from the Tags list.

    Select a radio button for the type of formatting you want for that tag.

    Shown is the Editors tab of the Options Properties dialog box. At top left is a list of Windows editors with Source View selected. At right is a Style group box with Tab Size box set to 2, Indent Size box set to 4, and radio buttons for Keep Tabs and Insert Spaces with Insert Spaces selected. Below the Style area are selected check boxes for Format Source and Indent Text, and a Line Width box with the entry 50. The bottom half of the screen has HTML Formattimg Options. In a list of available Tags, P is highlighted, and formatting radio button for Content on New Line if Line Width Exceeded is the one selected. A Sample of the selected format displays at bottom right.
  4. Repeat the previous step for as many types of tags as you want to format and click Apply.

  5. Select the Colors/Fonts tab.

    In the Window list, highlight Source View.

  6. Select a display element in the Types list.

    Modify the display element colors and fonts as desired.

  7. Repeat the previous step for as many display element types as you want to format, and click OK.