Page MenuHomePhabricator Annotate inserted content correctly
Open, LowPublic


Annotating inserted text correctly is complicated because the ideal rules would vary by annotation type. For example:

  • <i><i><b> or <i><b><i> should probably be collapsed to <i><b>;
  • but <small><small> should not be collapsed to <small>;
  • and <span dir="rtl"><span dir="ltr"><span dir="rtl"> cannot be collapsed (because text would get flipped to the wrong place);
  • and when pasting, it would be desirable to alter the tag stack to maximize continuity with the background text, subject to tag-specific rules like those above;

Furthermore, some desired rules would depend on the extent of the tags (and so cannot be applied at a single point in isolation); e.g.:

  • <i><a>...</a></i> is worse than <a><i>...</i></a>;
  • <b><i>foo</i></b> <i><b>bar</b></i> is worse than <b><i>foo bar</i></b> .