Handling paragraph-level formatting?
With #1 (closed) finished, the mappings of in-line formatting tags is working properly: (<b>
and <u>
become <i>
).
However, when an entire paragraph is formatted with bold, underlining, or italics, that property is promoted to the paragraph level. Consequently, bolding and underlining aren't mapped to italics, and even if they were, paragraph-level bolding, italics, and underlining is all dropped by Typescript.
Here's an example
Initial extraction
<p><span style="font-family: Helvetica"><b>Bold</b></span></p>
<p><span style="font-family: Helvetica"><i>italics</i></span></p>
<p><span style="font-family: Helvetica"><u>Underline</u></span></p>
After the rinse
step, properties are on the paragraph:
<p style="font-family: Helvetica; font-weight: bold">Bold</p>
<p style="font-family: Helvetica; font-style: italic">Italics</p>
<p style="font-family: Helvetica; text-decoration: underline">Underlined</p>
Finally, in the last Editoria reduce step, the style
properties are dropped and the above becomes the following:
<p>Bold</p>
<p>Italics</p>
<p>Underlined</p>
One solution might be to add a step in Typescript before the UCP cleanups that looks for one of these:
font-weight: bold
font-style: italic
text-decoration: underline
And handles them by adding an opening <b>
, <u>
, or <i>
right after the opening <p>
, and the related closing tag just before the </p>
. What do you think?