user2726995
user2726995

Reputation: 2062

Remove HTML Tags in Haskell

I have a string such as

<b>Vitamin A</b><br>Chloe Braided Halter Swim Top,

Using Text.HTML.TagSoup I am attempting to remove all html and just have

"Vitamin Chloe Braided Halter Swim Top" 

using

import qualified Text.HTML.TagSoup as TS 
TS.parseTags "<b>Vitamin A</b><br>Chloe Braided Halter Swim Top,"

[TagText "<b>Vitamin A</b><br>Chloe Braided Halter Swim Top,"]

How can I strip all HTML tags ?

Upvotes: 1

Views: 500

Answers (1)

Goens
Goens

Reputation: 415

Does it have to be with Text.HTML.TagSoup? It seems Hakyll.Web.Html would be a much better fit: https://hackage.haskell.org/package/hakyll-4.1.2.1/docs/Hakyll-Web-Html.html

There you have a function that does what it seems you want:

stripTags :: String -> StringSource

Strip all HTML tags from a string

Upvotes: 1

Related Questions