You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently table construction is handled with the primitives provided by BlockTextBuilder. Formatter walks through the model of an HTML table and calls the builder to construct the output table.
Contrary, ordered and unordered lists completely handled in the formatter, only block primitives are called.
Pros: smaller API of BlockTextBuilder;
Cons: no reusable primitives to construct nice custom lists. To achieve the same quality formatting will require to copy the whole list-formatting code.
Solution: add extra functions to BlockTextBuilder that will take some responsibilities of
Might not work with lists. Currently, all list item nodes are collected until all prefixes are known and walked only after that. Table cells have different requirements for text width, and rendered text is accumulated instead;
A compromise solution might be to leave it to client code to determine the max length of prefixes.
Can transfer the logic from existing formatter code;
Inconsistent with table building.
I'll need to review the table building, including WIP, to see whether it makes sense to change the API for tables. WIP code for tables wasn't going smooth, would be nice to find an improvement on both fronts.
I'm going with variant 1 and leave upfront max prefix length calculation in the formatter.
This provides most natural transition...
The text was updated successfully, but these errors were encountered:
An idea formed after discussion in #231
Currently table construction is handled with the primitives provided by
BlockTextBuilder
. Formatter walks through the model of an HTML table and calls the builder to construct the output table.Contrary, ordered and unordered lists completely handled in the formatter, only block primitives are called.
BlockTextBuilder
;Solution: add extra functions to
BlockTextBuilder
that will take some responsibilities ofnode-html-to-text/lib/formatter.js
Line 204 in 79f6731
thus reducing the amount of formatter-specific code and increasing the amount of reusable builder code.
API variant 1:
API variant 2:
I'll need to review the table building, including WIP, to see whether it makes sense to change the API for tables. WIP code for tables wasn't going smooth, would be nice to find an improvement on both fronts.
I'm going with variant 1 and leave upfront max prefix length calculation in the formatter.
This provides most natural transition...
The text was updated successfully, but these errors were encountered: