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

Radically improve Django mode #3197

wants to merge 12 commits into from


Copy link

@parisk parisk commented Apr 11, 2015

This pull request improves radically the Django mode by introducing more features and fixing some bugs.

In detail, this pull request introduces the following

  • Comment highlighting (both with inline tag and block comment tag)
  • String highlighting
  • Variable and variable attribute highlighting
  • Operator highlighting
  • Highlighting for filters
  • Definition of blockCommentStart and blockCommentEnd
  • Appropriate highlighting according to tag type: (variable, tag, comment)

This pull request also fixes two major bugs that made highlighting break:

  • Including keywords inside strings highlighted them as keywords instead of string
  • Mixing Django template highlighting with HTML highlighting in the same line broke the HTML highlighting

The only oddball in this pull request is the "null" token styling. Since the django mode is an overlay of django:inner over html, when using Django templates in HTML tag attributes, returning null results in string styling (because of the HTML tag attribute), instead of no styling. For this reason I returned "null" to avoid this.

The Django template language is described extensively at

This pull request can be tested at

Copy link

@marijnh marijnh commented Apr 13, 2015

Looks great! Merged as e22891b

@marijnh marijnh closed this Apr 13, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.