Closed mashedmonday closed 2 weeks ago
Maybe this comes handy: https://github.com/davidodenwald/prettier-plugin-jinja-template
Please provide a PR, because I wont create a PR
However, I did not touch the project for a while, so I might at least update the devDependencies
when I have time
Sorry, but I'm erring to recommend this should be a won't fix 😟
On a cursory look, Jinja is a string templating tool and, as far as I understand, it only processes its own syntax before outputting a string. On the other hand, Pug enforces specific syntax rules and doesn't tolerate unexpected symbols.
This plugin relies directly on the Pug parser, which expects correct Pug syntax. Modifying the plugin to support additional syntax's (like: Jinja, Handlebars, etc) would be a significant undertaking.
As a side note: I have concerns with the example you've provided. I would recommend against your current set up and use Pug exclusively. All of the Jinja syntax you've provided is supported out of the box with Pug.
@OiYouYeahYou This aligns with my internal thoughts 👍
Only if @mashedmonday (or another unknown contributor) is willing to put effort into this and it does not bring breaking changes or any conflicts with it, then I consider it as mergable. Otherwise I'm near to a "wont fix" / "close as not planned".
I am not aware i can use pug without jinja2 in python, but i will take a look. Thanks for your feedback still.
@mashedmonday just remove the percents and curlies, and you've got valid pug
doctype html
html
body(hx-ext="client-side-templates")
include "navbar.pug"
block content
include "footer.pug"
block javascript
Ref:
@OiYouYeahYou thanks for making this clear. I had to change some in may code due to different include searchpaths, but now this seems to work great.
Thanks a ton. Closing ticket.
Request / Idea
I use pug(js) in m python projects (from back in the days when it was called jade). However, i cannot apply the formatter to my pug templates right away because they come with jinja2 specific content. Jinja2 is a templating engine used alot in python. see example code below
Input
Expected Output
The code above, really. but little more consistent style. The jinja2 tags must remain and even need to be indented accordingly.
Additional Context