html-to-text / node-html-to-text

Advanced html to text converter
Other
1.61k stars 223 forks source link

ul tag without text wrap #303

Closed Adilmrqureshi closed 1 year ago

Adilmrqureshi commented 1 year ago

The goal I'm trying to display an unordered list in a PDF. I parse the string, which comes from the database and use PDF kit to generate a PDF from the parsed string.

Best attempt const convert = compile({ wordWrap: null, selectors: [ { selector: "ul", options: { itemPrefix: "• " } }, { selector: "ul.li", options: { wordWrap: false } }, ], });

The question Why does the text wrap, and how can I make <li> tags take the full width of the screen.

KillyMXI commented 1 year ago

wordwrap should be in all lowercase. Names are case-sensitive.

Interesting catch. Most properties are in camelCase. Seems like wordWrap might be more fitting. I'll think whether I should support that. Other somewhat questionable words present in settings: newlines, whitespace, uppercase. I'm more solid those don't require the change.

Side note: Your options are not correct in some other way as well, although that is not relevant to the issue:

Adilmrqureshi commented 1 year ago

Thank you