-
Notifications
You must be signed in to change notification settings - Fork 23
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
Formatter changes single quotation to double quotation in HTML markup per default #64
Comments
Mind: There is the option of setting |
Hey @renestalder my logic is always to use double quotes with HTML and single quotes with Liquid, I think my own tastes crept into things a little bit here, so thanks for the submission. I'll make sure to default these in Liquify. |
Hey @renestalder, I'm having trouble trying to find what option to put for "quote_convert": **** to convert double quotes to single quotes. Couldn't seem to find this anywhere in the docs, do you know what this needs to be set as? |
@naterodrigues See the rules in the section of the README. Here's what I did: {
"html": {
"correct": false,
"force_attribute": false,
"braces": false,
"preserve": 2,
"unformatted": false,
"quote_convert": "none"
}
} |
🚢 Shipped v3.0.0 |
When I format a liquid file with the formatter provider by vscode-liquid, the formatter changes single quotation marks of the HTML markup code to double quotations, all the time.
The default HTML formatter of vscode handles it correctly by keeping it as is.
Single quotations might be rarely used, but they can for example be useful when JSON data is provided via an HTML attribute's value. As JSON is bitchy about requiring double quotations all the time, the solution is to surround the value of the HTML attribute with single quotations to be able using double quotations in the value itself.
Example:
When formatting with vscode-liquid, it will result in this (see
data-font-families-value
value):I noticed earlier the day, when my client-side JavaScript code threw an error due to not being able to JSON parse the value it got from the HTML elements.
The text was updated successfully, but these errors were encountered: