AltF Flow recipe
Make an HTML list from lines of text
To publish a plain list on a web page, wrap each line in <li> tags and the whole block in <ul>. This recipe trims lines and drops blanks, HTML-escapes characters like & and < so they display correctly, applies an indented <li>{line}</li> template to each line and adds the opening and closing <ul> tags around the result.
- Free, no sign-up
- Runs in your browser
- Nothing uploaded
- Share recipes as a link
5 steps · runs in your browser · nothing uploaded
Pipeline
Remove leading and trailing spaces from each line.
6 → 6 linesRemove all
6 → 5 lines (-1)HTML escape
5 → 5 linesTemplate: <li>{line}</li>
5 → 5 linesPrefix: <ul>\n, Suffix: \n</ul>, Whole text
5 → 7 lines (+2)
6lines26words136chars
7lines28words209chars+1 lines vs input
The 5 steps in this recipe
- 1
Trim every line
Remove leading and trailing spaces from each line.
- 2
Remove empty lines - Remove all
Delete blank lines, or squeeze runs of blank lines down to one so paragraphs stay apart.
- 3
Encode or decode - HTML escape
URL, Base64, HTML entity and JSON string encoding, both directions.
- 4
Apply a line template - Template: <li>{line}</li>
Rewrite each line with a template. {line} is the line, {n} its number, {upper}, {lower} and {slug} are variants.
- 5
Add prefix / suffix - Prefix: <ul>\n, Suffix: \n</ul>, Whole text
Add text before and after every line, or around the whole result.
Change any option in the workspace above, switch a step off to compare, or add your own steps. Save it to reuse it, or share the recipe as a link.
Worked example
Free shipping on orders over $50 30-day returns Fits sizes S < M < L Made with cotton & recycled polyester Ships in 2-3 business days
<ul> <li>Free shipping on orders over $50</li> <li>30-day returns</li> <li>Fits sizes S < M < L</li> <li>Made with cotton & recycled polyester</li> <li>Ships in 2-3 business days</li> </ul>
Why escape before wrapping
A raw & or < in your text can break the HTML or be read as a tag. HTML escape converts &, <, >, quotes and apostrophes into entities first, and only then is the template applied, so the <li> tags you add are not escaped themselves.
Variations
- Change <ul> to <ol> in the last step for a numbered list.
- Use the template <li><a href="/{slug}">{line}</a></li> to link each item to a slug made from its text.
- Use <option>{line}</option> and a <select> wrapper to build a dropdown.
HTML list from lines: questions and answers
What does {line} mean in the template?
It is replaced by each line's text. {n} gives the line number, and {upper}, {lower} and {slug} give variants of the line.
Can I skip escaping if my text already contains HTML?
Yes. Delete the escape step if lines contain tags like <strong> that you want to keep.
Does it make nested lists?
No. Every line becomes one item at the same level.
More recipes like this
Writers and editors
- Trim every line
- Straighten smart quotes
- Find and replace
- Find and replace
- +1 more
- Straighten smart quotes
- Find and replace
- Collapse repeated spaces
- Trim every line
- +1 more
- Strip HTML tags
- Encode or decode
- Trim every line
- Remove empty lines
- +1 more
- Trim every line
- Remove empty lines
- Find and replace
- Add prefix / suffix
- Trim every line
- Remove empty lines
- Find and replace
- Number lines
Every step you can add (41)
Clean up
- Trim whitespace
- Trim every line
- Remove empty lines
- Collapse repeated spaces
- Remove line breaks
- Strip HTML tags
- Straighten smart quotes
- Remove accents
- Remove punctuation
- Remove emoji
- Remove non-ASCII characters
Change case
- Change case
- Make URL slugs
Lines
- Sort lines
- Remove duplicate lines
- Keep only duplicated lines
- Compare with another list
- Count repeated lines
- Reverse line order
- Shuffle lines
- Keep a range of lines
- Truncate long lines
- Wrap at a width
- Split into lines
- Join lines
Find and filter
- Find and replace
- Filter lines
- Remove words or characters
Extract
- Extract
Data and formats
- Format JSON
- Minify JSON
- CSV to JSON
- JSON to CSV
- Lines to JSON array
- JSON array to lines
Encode and decode
- Encode or decode
Build output
- Add prefix / suffix
- Quote each line
- Number lines
- Apply a line template
- Add timestamp
AltF Flow runs entirely in your browser. Your text is never sent to AltFTool; saved recipes stay in this browser and shared links carry the steps only.