framework icon indicating copy to clipboard operation
framework copied to clipboard

`<not-plaintext>` with links inside returns links url

Open michellaurent opened this issue 3 years ago • 2 comments

  • Maizzle Version: 4.2.0
  • Node.js Version: 18.9.0

The following code

<not-plaintext>
<p>No images? <a href="url">Click here</a>
</p>
</not-plaintext>

returns

url

when generating the text version.

It should return no text.

michellaurent avatar Oct 03 '22 15:10 michellaurent

It's happening because of dumpLinkHrefsNearby in string-strip-html - might be a bug there as it would make sense to not output any hrefs from tags that have been removed.

In Maizzle you can disable it by setting it to false in build.templates.plaintext.options, however I'll push an update soon to make it work just like in the docs, i.e. all plaintext options should go in build.templates.plaintext without the need for the options key.

cossssmin avatar Oct 05 '22 12:10 cossssmin

Opened an issue with string-strip-html: https://github.com/codsen/codsen/issues/54

cossssmin avatar Oct 05 '22 12:10 cossssmin

@michellaurent in the end we had to work around the issue in Maizzle, the string-strip-html library is now ESM and we're still CJS, and fixing this bug in their old CJS version would have not been sustainable in the long run.

Will release the fix in 4.2.3 sometime today, thanks for spotting it!

cossssmin avatar Oct 14 '22 09:10 cossssmin

@cossssmin Thanks !

michellaurent avatar Oct 14 '22 21:10 michellaurent