Jump to content
Antonius

Wrap plain text into html tags (unmarked and marked list)

Recommended Posts

Hi guys

 

Can anybody help me to create workflow for wrapping plain text to HTML? I'd like to wrap this list

 

item1

item2

item3

 

into

 

<ul>

<li>item1</li>

<li>item2</li>

<li>item3</li>

</ul>

 

The same question is for tables, I guess it's the similar to lists

Share this post


Link to post
Posted (edited)

Welcome @Antonius,

 

There you go. Quick and dirty ruby:

puts '<ul>'
puts ARGV[0].split("\n").reject(&:empty?).map { |line| '<li>' + line + '</li>' }
puts '</ul>'

Select the text, press the shortcut, and it’ll be replaced.

Edited by vitor
Updated Workflow link

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×