18

Is there a way to encode text inside an element in Emmet. For example if I want to create a would this be possible with emmet abbreviations?

Omegaman
  • 339
  • 1
  • 4
  • 13
  • 1
    Not sure if I understood this correctly. Can you give an example of what you would like to do? E.g. h1{My Text} will add the text inside h1 element tag like this

    My Text

    – Andy Mar 07 '17 at 19:36
  • 1
    Please accept the correct answer. – s3c Feb 12 '21 at 17:01

4 Answers4

45

You can use curly braces to add text to an element.

For example article{This is some text inside an article} expands to <article>This is some text inside an article</article>

aphilas
  • 2,066
  • 1
  • 14
  • 9
15

.item{My $ text}*3

<div class="item">My 1 text</div>
<div class="item">My 2 text</div>
<div class="item">My 3 text</div>
NIck Sh
  • 151
  • 1
  • 2
2
The first example starts from 1 and the second example starts from 6

ul>li.item$*5
<ul>
    <li class="item1"></li>
    <li class="item2"></li>
    <li class="item3"></li>
    <li class="item4"></li>
    <li class="item5"></li>
</ul>

ul>li.item$@6*5

<ul>
    <li class="item6"></li>
    <li class="item7"></li>
    <li class="item8"></li>
    <li class="item9"></li>
    <li class="item10"></li>
</ul>
anonymous
  • 1,499
  • 2
  • 18
  • 39
1

You can insert lorem ipsum to tags, e.g.

li.text-warning>lorem10

Result:

<li class="text-warning">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ex, molestias.</li>

Hope that workaround is ok.

mhermano
  • 89
  • 9