emacs-pug-mode icon indicating copy to clipboard operation
emacs-pug-mode copied to clipboard

Small elements inside headings are not being indented

Open ghost opened this issue 8 years ago • 5 comments

ghost avatar Dec 15 '16 22:12 ghost

Is this still an issue? If so, could you offer an explanation, or better: a screenshot? I don't understand the problem.

hlissner avatar Sep 12 '17 14:09 hlissner

Sure, sorry for not including a description I just noticed.

So I often write things like:

h1 Some heading
    small Subheading

But when I write the small Subheading element, if I hit tab it doesn't get indented under the h1.

I haven't written Pug in a while so I don't remember exactly, but it was something like that, I hope it helps.

ghost avatar Sep 13 '17 22:09 ghost

I'm not sure I follow. This is correct behavior for pug as far as I can tell, as h1 Some heading and small Subheading are two separate entities.

Pug lets you write inline tags (h1 Some heading) and block tags:

h1
  Some heading

Perhaps I misunderstood the problem, but as far as I know you can't do both at the same time.

hlissner avatar Sep 14 '17 11:09 hlissner

I was trying the following to confirm:

element Something
element Something else

It doesn't matter what the element is, when you write something like that and try to indent the second line nothing happens, you have to insert the spaces manually.

The expected behavior would be something like this:

element Something
    element Something else

to produce:

<element>Something
  <element>Something else</element>
</element>

But maybe I'm trying to do something wrong as you say (although it compiles as expected), perhaps it should be:

element 
  | Something
  element Something else

in which tab for indentation works just fine.

ghost avatar Sep 14 '17 19:09 ghost

Ah, I understand now. I was under the impression that this was illegal in pug templates. That throws a wrench into pug-mode's indentation heuristics. I'll need to rethink them.

hlissner avatar Sep 15 '17 23:09 hlissner