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

Correctly handle HTML <pre> elements #320

Open
fynnfeldpausch opened this issue May 12, 2020 · 2 comments
Open

Correctly handle HTML <pre> elements #320

fynnfeldpausch opened this issue May 12, 2020 · 2 comments

Comments

@fynnfeldpausch
Copy link

fynnfeldpausch commented May 12, 2020

While Autolinker correctly handles <a> tags in the input string, it does not handle HTML <pre> elements correctly and will apply auto-linking within those texts.

Expected
Autolinker.link(<pre>https://www.test.com</pre>) to be <pre>https://www.test.com</pre>.

Actual
Autolinker.link(<pre>https://www.test.com</pre>) is <pre><a href="https://www.test.com" target="_blank" rel="noopener noreferrer">test.com</a></pre>.

@fynnfeldpausch
Copy link
Author

Ideally, This would be configurable since I also would like to avoid auto-linking in <code> elements

@gphaydon
Copy link

Is there anyway to prevent Autolinker from touching <pre> elements? I was wondering if, given no other config option, if replaceFn could be used to switch it off when the ancestor tag is a pre.

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

No branches or pull requests

2 participants