I have some templates that are somewhat close but not exactly what you need. In pretty much all cases I’m using “black magic” to read line formatting from the object that represents rich text (ranges in the current gen editor and slate in the next gen editor).
If you’re dealing with actual HTML you can as well tokenize it — I built it on a Patron stream (somewhere closer to the end lol)