How sublime customizes the ejs content of a label package

for example, I want to wrap Hello world as <% = Hello world% > .

how do you realize it? Emmet seems to be able to wrap only built-in html elements, while sublime"s snippet can only generate fragments in advance and fill in the fragments

In the actual writing process of

ejs, symbols such as <%% > are inefficient

.
<ul>
        <% users.forEach(users=>{ %>
            
        <% }) %>
</ul>

Please put your heads together and see if you can improve the efficiency of writing this kind of thing. Thank you


snippet + keymap is generally required for processing selected text. Here's a ready-made one to achieve your effect: https://github.com/samholmes/....

for example, the corresponding snippet file ejs_insert_tags.sublime-snippet (shortcut key = + tab ):

<snippet>
  <content><![CDATA[<%${1:= }${2:$SELECTION} %>$0]]></content>
  <description><![CDATA[<%(=) 'insert ejs tags' %>]]></description>
  <!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
  <tabTrigger>=</tabTrigger>
  <!-- Optional: Set a scope to limit where the snippet will trigger -->
  <scope>text.html</scope>
</snippet>

corresponding key binding (shortcut key: ctrl + shift +. ):

[{
  "keys": ["ctrl+shift+."],
  "command": "insert_snippet",
  "args": {
    "name": "Packages/User/ejs_insert_tags.sublime-snippet"
  }
}]
Menu