-
-
Notifications
You must be signed in to change notification settings - Fork 382
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
Feature request: add support for Django / Jinja templates #24
Comments
I'm looking into this but I have a question. I found this repo which includes a lot of syntaxes for various combinations of Jinja with other languages. This works just fine in VS Code due to file extensions but with The question is what is the desired API? Do we want to have things work automagically when we just pass Or we just add Jinja's raw syntax and leave it at that. Thoughts? |
At least for me during past ~15 years of Django development, most code involving Djano/Jinja templates have mostly or fully been HTML-only (not including special cases when you're intentionally writing something special w/ other languages but usually no code formatter works in those cases). I'm not sure what's the difference between first case and just implementing the raw Jinja syntax? I think the initial solution could (and should) be as simple as possible, and if someone needs a more fine-tuned API, they can file a new ticket for the specific use case which then can be evaluated case by case. In other words, the basic use case would be |
Alright, that makes a lot of sense :) I'll try to get something up this weekend |
I'm not sure if something is missing, but this doesn't look right and I'm not familiari with Jinja. I'm using: |
Indeed, no, it does not look right. Jinja is a superset of Django templates, most Django (vscode) plugins seem to get the syntax right. Although, as with all templates and colorizations, it's also somewhat of opinion as well... |
It seems django can generate any text file and has no strict grammar. How should it be highlighted then? |
Well that is true in the sense that Django is just a tool like Vue, but Django templates do have a strictly defined grammar just as Vue templates do. (You can opt-out from using the template language but obviously then you're not expecting to use template highlighter tools either.) I'm not really sure how Django templates are defined, though. I'm sorry if my previous comment was misleading. I meant that the styling (theme) of the syntax highlighting is a matter of opinion, not the syntax itself. (In the posted example above the HTML is not properly highlighted for example, but most Django template tools do highlight HTML as it should be in my opinion.) If it helps I can dig up the source for Django templates or maybe some examples of vscode plugins? I'm not an expert of these matters by any means but I'm happy to help in any way I can. |
Django / Jinja templates are heavily used in Python world and would be great addition to Shiki supported languages.
In an unrelated note, Kudos for this awesome library, yet another home run 👍
The text was updated successfully, but these errors were encountered: