Click here to Skip to main content
15,077,141 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Currently I'm using Tidy to format my code in Vim 8.2 using ale fixers. Everything is working, but while working with Django HTML files I need to have custom line breaks which Tidy doesn't let me.

My HTML code:
HTML
<pre><link rel="stylesheet" href="/static/home/css/font-awesome.css">
<link rel="stylesheet" href="/static/home/css/main.css">
<script src="/static/home/js/vendor/modernizr-2.6.2.min.js"></script>
{% block extrahead %}{% endblock extrahead %}
{% block extrastyle %}{% endblock extrastyle %}


After formatting I get
HTML
<pre><link href="/static/home/css/font-awesome.css" rel="stylesheet">
<link href="/static/home/css/main.css" rel="stylesheet">
<script src="/static/home/js/vendor/modernizr-2.6.2.min.js"></script> {% block extrahead %}{%
endblock extrahead %} {% block extrastyle %}{% endblock extrastyle %}



Tidy removes the breaks I added and reformat the correct code too. And that causes an error in Django (Invalid block tag on line 5: 'endwith', expected 'endblock'. Did you forget to register or load this tag?).

Tidy line width is 99 and it's filling all lines, if there wasn't any block element (I mean Tidy block tags which cause line breaks) and it ignores my custom breaks and re-writes those lower than 99 char line too.

Here is my Tidy configuration file:
indent: auto
indent-spaces: 2
wrap: 99
markup: yes
show-warnings: yes
uppercase-tags: no
new-inline-tags: cfif, cfelse, math, mroot,
  mrow, mi, mn, mo, msqrt, mfrac, msubsup, munderover,
  munder, mover, mmultiscripts, msup, msub, mtext,
  mprescripts, mtable, mtr, mtd, mth
new-blocklevel-tags: cfoutput, cfquery
new-empty-tags: cfelse
sort-attributes: alpha
replace-color:yes


What I have tried:

I tried most of these options
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900