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

Formatting liquid templates for non-HTML content #205

Open
1 task done
amit777 opened this issue Aug 24, 2023 · 0 comments
Open
1 task done

Formatting liquid templates for non-HTML content #205

amit777 opened this issue Aug 24, 2023 · 0 comments

Comments

@amit777
Copy link

amit777 commented Aug 24, 2023

Is your feature request related to a problem? Please describe.
We are using liquid templates within text templates that are not HTML (ie, for text email content). When we use the prettier plugin, multiple whitespace and linebreaks get removed.

Describe the solution you'd like
I would love to be able to pass a config option like "textTemplate: true" to make prettier just format the liquid tags and not the text between them.

Describe alternatives you've considered
Have tried looking for other prettier plugins that support liquid but this seems to be the standard one.

Checklist

  • I have checked and made sure that the proposal adheres to this plugin's principles

I believe the extra whitespace is meaningful in text templates. I've read through this link as well: https://github.com/Shopify/prettier-plugin-liquid/blob/main/docs/whitespace-handling.md

I'm not sure if this prettier module is supposed to be specialized for HTML?

Additional context
Here is an example before/after for a template that I'm looking for:

Before:
{% if foo=="bar" %}FOO SPACE{%endif%}

After (current):
{% if foo == "bar" %}FOO SPACE{% endif %}

Desired Output (no removal of the spaces in between FOO and SPACE but the spacing within a liquid tag are correct):
{% if foo == "bar" %}FOO SPACE{% endif %}

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

1 participant