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

Retain Attribute Spacing #1303

Open
ackava opened this issue Oct 17, 2024 · 1 comment
Open

Retain Attribute Spacing #1303

ackava opened this issue Oct 17, 2024 · 1 comment

Comments

@ackava
Copy link

ackava commented Oct 17, 2024

https://astexplorer.net/#/gist/033016ca9df38fea6ac05b61a474df63/74f7e3fff5a4f3771383394151c4a36454399f92

Is there anyway to retain attribute spacing? Check a attribute in h1.

Text Nodes contain whitespaces and whitespace can retain correctly.

I know attribute doesn't have prefix/suffix whitespaces in the HTML spec, but it would be of great help to retain space for WYSWYG editors.

When there are multiple attributes specified, we usually indent them one after another.

@wooorm
Copy link
Collaborator

wooorm commented Oct 17, 2024

That’s not the job of an AST. No AST persists whitespace. You are trying to do things with parse5 which it can never do. Now, the root question of this question you ask, perhaps there is a solution to that. But I do not know what you want. Please ask what you really really want.

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

4 participants
@wooorm @ackava and others