Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Pretty-printing
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Pretty-printing markup and tag-based code== [[File:HTML source code example.svg|thumb|HTML source code, pretty-printed to better show the hierarchical relationships of its elements (called tags)]] Pretty-printing in markup language instances is most typically associated with [[indentation (typesetting)|indentation]] of tags and string content to visually determine hierarchy and nesting. Although the syntactical structures of tag-based languages do not significantly vary, the indentation may vary significantly due to how a markup language is interpreted or due to the data it describes. In [[MathML]], [[whitespace character]]s do not reflect data, meaning, or syntax above what is required by [[XML]] syntax. In [[HTML]], whitespace characters between tags are considered text and are parsed as text nodes into the parsed result.<ref>{{cite web |url=https://developer.mozilla.org/en-US/docs/Whitespace_in_the_DOM |title=Whitespace in the DOM |first=L. David |last=Baron |publisher=Mozilla Developer Network |accessdate=27 August 2012}}</ref> 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<ref>[https://github.com/prettydiff/prettydiff/blob/master/beautify/markup.ts markup.ts]</ref> application component used to beautify HTML, XML, and related technologies for the [[Pretty Diff]] tool.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)