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

add leading and trailing whitespace to text nodes #89

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

milahu
Copy link

@milahu milahu commented Mar 5, 2024

fix #87

@milahu milahu force-pushed the add-leading-and-trailing-whitespace-to-text-nodes branch from c8b9a1e to 6c27900 Compare March 5, 2024 10:42
@milahu milahu force-pushed the add-leading-and-trailing-whitespace-to-text-nodes branch from 6c27900 to 653d7b2 Compare March 5, 2024 10:46
@milahu milahu force-pushed the add-leading-and-trailing-whitespace-to-text-nodes branch from 653d7b2 to 8801a68 Compare March 5, 2024 10:48
@amaanq
Copy link
Member

amaanq commented May 4, 2024

should the first newline even be considered? what about text: _ => /[^<>&\n][^<>&]*/?

@milahu
Copy link
Author

milahu commented May 4, 2024

yes, the parser should be lossless
everything outside of tags should be parsed as text

the text regex could be even more greedy like /[^<&]+/ to allow > in text
but i cant remember if i tested that
maybe > is already parsed as "unescaped entity &gt;" which would be a bit wasteful

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 this pull request may close these issues.

leading and trailing whitespace is lost when it should be part of text nodes
2 participants