Menci
Menci

Reputation: 173

How to write a comment with Emmet plugin in Sublime?

Im using sublime 2 with Emmet plugin. Is there a way to write a comment with speed coding that would produce me something like that:

<div class="container">
   Lorem ipsum
</div> <!-- custom comment -->

I've tried

div.container

And it's not working.

Is it possible to add comments to each div or element created via speed coding snippets?

Upvotes: 13

Views: 10978

Answers (4)

Som Shekhar Mukherjee
Som Shekhar Mukherjee

Reputation: 8168

c>{some comment} will give you a comment with text "some comment" in it.


To have a comment after a div, you can use the following:

div.container+c{custom comment}

enter image description here


If you also want to have some text inside the div, you can use the following:

div.container{Hello World}+c>{custom comment}

enter image description here


If you want to have something after the comment, you need to group it using brackets as shown below:

div.container{Hello World}+(c>{custom comment})+div#nav

enter image description here

Upvotes: 1

Jay
Jay

Reputation: 1147

I believe this is what you're looking for:

c{test}+div>p{Comments!}^c{/test}

Upvotes: 0

Jorge Cedi Medina
Jorge Cedi Medina

Reputation: 19

Use filters:

div>div#page>p.title+p|c

Reference: http://docs.emmet.io/filters/

Upvotes: 1

Endika Llonin
Endika Llonin

Reputation: 161

You can write quick comand c+tab for simple comment or you can write in this form c{my comment}+tab to add text into de comment tags

Upvotes: 16

Related Questions