It would be nice to not need manual page breaks-- the document should automatically determine where page breaks are needed and create a new page. Manual page breaks would still be allowed.
An example of a web document editor that manages to do this is Google Docs.
Likely, some method of calculating the height of elements and determining when that total height is greater than the page/container height, and then splitting the last element that overflows into a new page/container. Calculating heights of whole elements is likely "easy", but a library would likely be needed for calculating exactly where to split the text node of the last element.
There are likely a million edge cases where this will have poor results. But I think it's worth a try at some point, if for no other reason than to have a good answer when someone else asks for it.
Your idea:
It would be nice to not need manual page breaks-- the document should automatically determine where page breaks are needed and create a new page. Manual page breaks would still be allowed.
An example of a web document editor that manages to do this is Google Docs.
Likely, some method of calculating the height of elements and determining when that total height is greater than the page/container height, and then splitting the last element that overflows into a new page/container. Calculating heights of whole elements is likely "easy", but a library would likely be needed for calculating exactly where to split the text node of the last element.
Or, a library to handle it all (paged.js).
There are likely a million edge cases where this will have poor results. But I think it's worth a try at some point, if for no other reason than to have a good answer when someone else asks for it.