pugjs / pug

Pug – robust, elegant, feature rich template engine for Node.js
https://pugjs.org
21.54k stars 1.96k forks source link

Spans and inline tags syntax? #3388

Closed JonathanILevi closed 1 year ago

JonathanILevi commented 1 year ago

Pug Version: 2.0.4

Node Version: 18.5.0

Spans and inline tags seem to have been forgotten in the syntax. In order to do a span or other inline tag I have to resort to standard HTML syntax. For plain <b>, <i>, <a> and etc that works fine, but when adding classes it starts to feel like heavyweight HTML again and not the smooth, convenient Pug. Example: <span class="interesting">content</span> is cumbersome, and seams like basic enough usage that it should be considered.

My shot-from-the-hip thought on a possible syntax improvement would be to allow classes and ids to be added in HTML tags akin to other Pug syntax: <span.interesting>content</span>. Better yet, just like "div" is default for block tags, make "span" default for inline tags: <.interesting>content</>. For consistency sake make </> a generic close tag: <b>content</>.

ForbesLindesay commented 1 year ago

https://pugjs.org/language/interpolation.html#tag-interpolation