Prettyprint

Pretty-printing (or prettyprinting) is the application of any of various stylistic formatting conventions to text files, such as source code, markup, and similar kinds of content.

These formatting conventions may entail adhering to an indentation style, using different color and typeface to highlight syntactic elements of source code, or adjusting size, to make the content easier for people to read, and understand.

Pretty-printing in markup language instances is most typically associated with indentation of tags and string content to visually determine hierarchy and nesting.

[2] While indentation may be generously applied to a MathML document, sufficient additional care must be taken in pretty-printing an HTML document to ensure additional text nodes are not created or destroyed in general proximity to the content or content-reflective tag elements.

This difference in complexity is non-trivial from the perspective of an automated pretty-print operation where no special rules or edge cases are necessary, as in the more simple MathML example.

The HTML example may require a series of progressive interrelated algorithms to account for various patterns of tag elements and content that conforms to a uniform style and is consistent in application across various instances, as evidenced by the markup.ts[3] application component used to beautify HTML, XML, and related technologies for the Pretty Diff tool.

Code beautifiers exist as standalone applications and built into text editors and integrated development environments.

Early versions operated on the executable (list structure) form of the Lisp program and were oblivious to the special meanings of various functions.

A typeset mathematical expression
HTML source code, pretty-printed to better show the hierarchical relationships of its elements (called tags)