12

How can one format django template in Sublime Text. My template consists of:

  1. HTML (django template language with {{ variable }} and {% stuff %})
  2. javascript

Is there a way to get same kind of formatting PyCharm provides?

Vladimir Nani
  • 2,774
  • 6
  • 31
  • 52

2 Answers2

18

This package should help: https://github.com/squ1b3r/Djaneiro

Here are some tips on install: How to install plugins to Sublime Text 2 editor?

Community
  • 1
  • 1
Shaun Singh
  • 519
  • 4
  • 11
  • i do not see syntax in javascript section – Vladimir Nani Jun 20 '13 at 16:22
  • There is an error in this plugin, it uses {# #} to comment multiple lines in html templates which won't comment out anything. Instead, you are supposed to use the comment tag. – Mike Lee Feb 15 '14 at 00:52
  • I wasn't sure about Djaneiro at first but after using it for a while I found it extremely helpful. The improved syntax highlighting for Django templates is awesome. I ended up writing a quick review and feature walkthrough for it: https://dbader.org/blog/sublime-text-djaneiro-review – dbader Oct 11 '16 at 12:37
5

A couple different things:

Djanerio has a nice set of auto-completion and color schemes specific to Django. Check out their README file to see the list of available substitutions

JSFormat is also great for javascript in ST2, for your templates

Colorpicker offers a generic css color sheet that you can tinker with. This comes in handy for things all of the above doesn't pick up on.

JcKelley
  • 1,954
  • 1
  • 15
  • 30