Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<not-plaintext> with links inside returns links url #780

Closed
michellaurent opened this issue Oct 3, 2022 · 4 comments · Fixed by #803
Closed

<not-plaintext> with links inside returns links url #780

michellaurent opened this issue Oct 3, 2022 · 4 comments · Fixed by #803

Comments

@michellaurent
Copy link

  • 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 michellaurent changed the title <not-plaintext> with links inside returns links url <not-plaintext> with links inside returns links url Oct 3, 2022
@cossssmin
Copy link
Member

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
Copy link
Member

cossssmin commented Oct 5, 2022

Opened an issue with string-strip-html: codsen/codsen#54

@cossssmin
Copy link
Member

@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!

@michellaurent
Copy link
Author

@cossssmin Thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants