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

\n in attributes is not handled as delimiter #33

Closed
BANOnotIT opened this issue Aug 18, 2021 · 1 comment
Closed

\n in attributes is not handled as delimiter #33

BANOnotIT opened this issue Aug 18, 2021 · 1 comment

Comments

@BANOnotIT
Copy link
Contributor

The problem

If I pass this code

<a href="/#tester">normal link</a> 

<a href="/#you-will-never-see-this"
moz-do-not-send="true">link from moz</a>

to the html2md method, it'll produce this code

[normal link](/#tester) 
[link from moz]()

But if we add a space char between href and moz-specific attribute

(like this ...ee-this"\n moz-... or like this ...ee-this" \nmoz-...)

it'll produce normal link:

[normal link](/#tester) 
[link from moz](/#you-will-never-see-this)

Possible fix

I think that the parser you use only counts spaces as attributes separators, but instead I would recomend use ' ' | '\n', and it might be better to use \s from RegExp.

stonehank added a commit that referenced this issue Aug 20, 2021
@stonehank
Copy link
Owner

Thanks
Yes, the reason is only detect the ' ' inside tag attributes, now(v0.4.4) replace\s with it.

stonehank added a commit that referenced this issue Sep 2, 2021
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