Closed SnijderC closed 7 years ago
Interesting, thanks for that find. I think I can fix that pretty quickly, the pre-tag just needs to render inline all the time.
You may pull *@dev
and test it :)
I implemented a new option called force_inlined_tags
(Default value is ['pre', 'code']
)
Having an element force inline will disable pretty-printing for it and all of its children automatically, so you can even use HTML inside pre
without breaking it.
Notice this works only in HTML and XHTML mode, in XML-mode pre and code will be normal elements and indented as any other one.
Please give me a short feedback if this problem is fixed for you, I'll issue a release as soon as I fixed some other stuff.
Assuming tale-jade is in pretty printing mode, it seems the way the compiler works is to unwind the node hierarchy, adding extra the set indentation type for every level in the hierarchy. This doesn't work when compiling pre tags because any indentation added to the content of the pre tag will be interpreted by the browsers instead of ignored. So when we do this:
It is rendered as:
Note that with pre this renders as a pre with 8 spaces prepended and 7 spaces appended.
A link to the sandbox site for reference: http://sandbox.jade.talesoft.codes/id-58209a041c37e.html
Expected result: when
<pre>
is compiled indentation is not added.