Okay, I have taken a shot at giving the user more control over the output generated by Mend and Prettify.
This takes the form of some simple settings such as indent string per level, doublespace in body after key content, and sets of tag names.
These sets control how a tag is indented and if a return is injected, etc.
You now have control over all of this in your Sigil Prefs in an auto created file called prettyprint.xml.
So those who hated Sigil's prettyprinting of tables, should now be able to move td, and tr out of the "structural" set and into the "inline" set to change how they are treated by pretty print.
Here is the default prettyprint.xml:
Code:
<?xml version="1.0" encoding="utf-8"?>
<prettyprint>
<!-- actual string added in front to indent one level, typically 2 or 4 blanks, quotes needed -->
<indent_string>" "</indent_string>
<doublespace>true</doublespace>
<!-- set membership of tags determine when and where whitespace is compressed, and newlines added -->
<!-- Structural tags open and close on their own lines with contents properly indented -->
<structural_tags>
annotation, annotation-xml, article, aside, blockquote,
body, canvas, colgroup, div, dl, figure, footer, head, header,
hr, html, maction, math, menclose, mfrac, mmultiscripts, mover,
mpadded, mphantom, mroot, mrow, msqrt, mstyle, mtable, mtd, mtr,
munder, munderover, nav, ol, section, semantics, table, tbody,
tfoot, thead, td, th, tr, ul
</structural_tags>
<!-- Inline tags have no added space nor newlines -->
<inline_tags>
a, abbr, acronym, b, bdo, big, br, button, cite, code, del, dfn, em,
font, i, image, img, input, ins, kbd, label, map, mark, mbp:nu, mi,
mn, mo, ms, mspace, mtext, msub, msup, msubsup, nobr, object, q,
ruby, rp, rt, s, samp, select, small, span, strike, strong, sub,
sup, textarea, tt, u, var, wbr
</inline_tags>
<!-- Void tags are tags that can not have contents and therefore must self-close -->
<void_tags>
area, base, basefont, bgsound, br, col, command, embed, event-source,
frame, hr, img, input, keygen, link, maligngroup, malignmark,
mbp:pagebreak, meta, mglyph, mprescripts, msline, mspace, none,
param, source, spacer, track, wbr
</void_tags>
<!-- Preserve Space tags are tags whose content's whitespace can not be changed or compressed -->
<preservespace_tags>
code, cs, pre, textarea, script, style
</preservespace_tags>
<!-- No Entity Substituion tags are those whose contents should not have any entities expanded -->
<noentitysub_tags>
script, style
</noentitysub_tags>
<!-- Text holder tags are tags that typically have text content -->
<textholder_tags>
address, caption, dd, div, dt, figcaption, h1, h2, h3, h4, h5, h6,
legend, li, option, p, td, th, title
</textholder_tags>
</prettyprint>
I have pushed the code to master that implements all of this for people to play with, test, tryout and feedback your ideas.
So if you build your own, please try pulling from master and playing around with the prettyprint.xml that is created inside Sigil's Preferences. Note, changes to this file require Sigil to be restarted to take effect.
All thoughts and comments welcome. I know it is a bit complicated but once set it should be very very flexible to match your preferred prettyprint style then it can be forgotten about.