Skip to content
HTML Pack
Share
Explore

Examples

Working examples to educate and inspire
Extracting Data from HTML
Get All Hyperlinks
Formula
HTML::Hyperlinks('My cat <em>loves</em> <a href="https://coda.io">Coda</a>, especially <a href="https://coda.io/formulas">the formulas</a>')

Result
https://coda.io/
https://coda.io/formulas

Get All Images
Formula
HTML::SetAttribute('<div><img src="https://placekitten.com/200/200"><img src="https://placekitten.com/150/250"><img src="https://placekitten.com/250/150"></div>')

Result

Get All Heading Text
Formula
HTML::QuerySelectorAll('<h1>My Doc</h1><h2>Is Really</h2><p>Cool</p>', 'h1, h2').TextContent

Result
My DocIs Really

Modifying HTML
Remove hyperlinks
Formula
HTML::StripTags('My cat <em>loves</em> <a href="https://coda.io">Coda</a>', 'a')

Result
My cat <em>loves</em> Coda

Add rel=nofollow to hyperlinks
Formula
HTML::SetAttribute('This <a href="https://fortes.com/">site</a> is really cool', 'a', 'rel', 'nofollow')

Result
This <a href="https://fortes.com/" rel="nofollow">site</a> is really cool

Removing all Images
Formula
HTML::Remove('Sarasota is <b>nice</b> this time of year <img src="sarasota.jpg">', 'img')

Result
Sarasota is <b>nice</b> this time of year

Converting HTML
Convert HTML to Markdown
Formula
HTML::ToMarkdown('My cat <em>loves</em> <a href="https://coda.io">Coda</a>')

Result
My cat _loves_ [Coda](https://coda.io)

Display String as HTML
Formula
HTML::ToHtml('This <a href="https://fortes.com/">site</a> is <em>really</em> cool')

Result
This
is really cool

Convert HTML to Plain Text
Formula
HTML::ToPlainText('This <a href="https://fortes.com/">site</a> is <em>really</em> cool')

Result
This site is really cool


Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.