If you are particular about the layout of your HTML code, you might want to disable HoTMetaL's source layout feature by going to the Tools menu, Customizations, and on the Source Layout tab, uncheck the box that is labelled Enable Source Layout. Then when you open a document in HoTMetaL, it will preserves all the spaces and line breaks in your original document.
It would be handy, though, to be able to apply automatic layout on demand, either to the whole document or some currently selected code. That's what the macros below let you do.
Copy the macros in macros.txt into the hotmetal.mcr file found in the Macros folder of your HoTMetaL PRO application folder. These macros would be good candidates to put on toolbar buttons or as menu items.
We use the standard technique of defining some useful constants in this macro so they are available to other macros later.
<MACRO name="On_Application_Open" lang="JScript"><![CDATA[ var viewWYSIWYG = 0; var viewTagsOn = 1; var viewSource = 2; ]]></MACRO>
This macro will layout the whole document, applying the source layout properties specified in the Customizations dialog.
<MACRO name="Layout Document" lang="JScript" id="52" desc="Apply source layout to entire document"><![CDATA[ if (ActiveDocument.ViewType == viewSource) { ActiveDocument.Layout(); } else { Application.Alert("Applying source layout only works in source view.\nSwitch to source view and try again."); } ]]></MACRO>
This macro will just apply layout to the current selection. Using it, you can selectively apply the layout properties specified in the Customizations dialog.
<MACRO name="Layout Selection" lang="JScript" id="53" desc="Apply source layout to the current selection"><![CDATA[ if (ActiveDocument.ViewType == viewSource) { Selection.Layout(); } else { Application.Alert("Applying source layout only works in source view.\nSwitch to source view and try again."); } ]]></MACRO>