Emmet - Wrap with Abbreviation - Token that represents the wrapped text i.e. {original text}

StackOverflow https://stackoverflow.com/questions/17645397

  •  03-06-2022
  •  | 
  •  

سؤال

I'm attempting to convert a list of URLs into HTML links as lazily as possible:

www.annaandsally.com.au
www.babylush.com.au
www.babysgotstyle.com.au
... etc

Using wrap in abbreviation, I'd like to do something like: a[href="http://${1}/"]*

The expanded abbreviation would result in:

<a href="http://www.annaandsally.com.au/">www.annaandsally.com.au</a>
<a href="http://www.babylush.com.au/">www.babylush.com.au</a>
<a href="http://www.babysgotstyle.com.au/">www.babysgotstyle.com.au</a>
... etc

The missing piece of the puzzle is an abbreviation token that represents the text being wrapped.

Any idea if this can be done?

هل كانت مفيدة؟

المحلول 2

Sergey from Emmet was kind enough to point me in the right direction. The $# token contains the original content:

a[href="http://$#/"]*>{$#}

By specifying $# as the href attribute, the original content is no longer 'wrapped' and must be be reinserted via {$#}.

http://docs.emmet.io/actions/wrap-with-abbreviation/#controlling-output-position

نصائح أخرى

If they are already on their own lines (which in the question, they look like they are), a simple Find and Replace with RegEx turned on will work. The Params are as follows:

Find What:

(.+)

Replace With:

<a href=\"http://$1\">$1</a>

Before

See Here

After

enter image description here

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top