I'm using sekizai in the Professional version of PyCharm to control where my JavaScript code is rendered to in the page.
In my django template code, this means that my JavaScript is not enclosed in the usual <script>
tags and therefore does not have syntax highlighting, e.g. Normally I would have...
<script type="text/javascript">
alert("Syntax highlighting works");
</script>
Instead I have something like:
{% addtoblock "js" %}
alert("No syntax highlighting!");
{% endaddtoblock %}
Is there a quick fix for this? The <script>
tags exist once in my base template and I'm trying to avoid moving the tags inside {% addtoblock %}
:
<script type="text/javascript">
{% render_block "js" %}
</script>
I contacted PyCharm support in Oct '17.
Their lead Django integration developer replied that currently this case is not supported...
But, I'm sure this would be possible if you knew how to add a new syntax highlighting rules. It should be possible to adapt the answer here: https://stackoverflow.com/a/41044381/1624894