better-comments
better-comments copied to clipboard
Add Jade (Pug) Support
Trying to add Jade (Pug) support
Oh very nice! I was just coming to figure out how to submit my fix for this. Looks like you have it pretty well covered, but I had to use all 3 params for it to work. I also added both languages pug/jade parcer.ts and as well in package.json.
case "pug": case "jade": this.setCommentFormat("//", "<!--", "-->"); break;
The reason I used "//" over "//-" is because I like how it handles exampled above. Also this keeps how it is handled more in line with Sass.
Sorry I am newish to github or I would have shared sooner (still need to learn how).
Good catch, I will add .pug
files to this PR.
I went with "//-" over "//" because I didn't want those comments appearing in the rendered HTML. Per the docs:
Pug also supports unbuffered comments. Simply add a hyphen (-) to the start of the comment. These are only for commenting on the Pug code itself, and do not appear in the rendered HTML.
Don't want users to see <!-- TODO: stuff that needs fixing -->
if they ever were to inspect in dev tools.
I went with "//-" over "//" because I didn't want those comments appearing in the rendered HTML. Per the docs:
This is totally understandable but it cause's conflicts for me. If you look at the above screenshot you will see that if "//" is used in better comments it works for both.
If you put "//-" only it will work for those types, and comments with "//" would be ignored still by the better colors extension.
// is the primary comment per docs as well. https://pugjs.org/language/comments.html
Sass works much the same way, so its up to the coder if you want your comments in markup.
Good point. I'll edit the PR.
Any update?