AutoFormat.RemoveEmpty.txt 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. AutoFormat.RemoveEmpty
  2. TYPE: bool
  3. VERSION: 3.2.0
  4. DEFAULT: false
  5. --DESCRIPTION--
  6. <p>
  7. When enabled, HTML Purifier will attempt to remove empty elements that
  8. contribute no semantic information to the document. The following types
  9. of nodes will be removed:
  10. </p>
  11. <ul><li>
  12. Tags with no attributes and no content, and that are not empty
  13. elements (remove <code>&lt;a&gt;&lt;/a&gt;</code> but not
  14. <code>&lt;br /&gt;</code>), and
  15. </li>
  16. <li>
  17. Tags with no content, except for:<ul>
  18. <li>The <code>colgroup</code> element, or</li>
  19. <li>
  20. Elements with the <code>id</code> or <code>name</code> attribute,
  21. when those attributes are permitted on those elements.
  22. </li>
  23. </ul></li>
  24. </ul>
  25. <p>
  26. Please be very careful when using this functionality; while it may not
  27. seem that empty elements contain useful information, they can alter the
  28. layout of a document given appropriate styling. This directive is most
  29. useful when you are processing machine-generated HTML, please avoid using
  30. it on regular user HTML.
  31. </p>
  32. <p>
  33. Elements that contain only whitespace will be treated as empty. Non-breaking
  34. spaces, however, do not count as whitespace. See
  35. %AutoFormat.RemoveEmpty.RemoveNbsp for alternate behavior.
  36. </p>
  37. <p>
  38. This algorithm is not perfect; you may still notice some empty tags,
  39. particularly if a node had elements, but those elements were later removed
  40. because they were not permitted in that context, or tags that, after
  41. being auto-closed by another tag, where empty. This is for safety reasons
  42. to prevent clever code from breaking validation. The general rule of thumb:
  43. if a tag looked empty on the way in, it will get removed; if HTML Purifier
  44. made it empty, it will stay.
  45. </p>
  46. --# vim: et sw=4 sts=4