Blockzilla
Blockzilla2y ago

Looking for a library to pretty print </br>, <a>, etc tags

As that title says, I'm looking for a library that can pretty print a string containing the mentioned tags, it should also be able to parse &amp; etc, Does such a library exist? Example:
Lorem ipsum dolor sit amet,</br> consectetur adipiscing elit.</br> <b>Aliquam</b> quis augue eu metus efficitur dapibus. Ut pharetra ullamcorper vestibulum
Lorem ipsum dolor sit amet,</br> consectetur adipiscing elit.</br> <b>Aliquam</b> quis augue eu metus efficitur dapibus. Ut pharetra ullamcorper vestibulum
should output something like this: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam quis augue eu metus efficitur dapibus. Ut pharetra ullamcorper vestibulum
5 Replies
Blockzilla
BlockzillaOP2y ago
i tried googling it but i honestly don't know the proper keywords to find something useful
marvinh.
marvinh.2y ago
There are a couple of HTML pretty printing libraries. It looks like you're working with HTML. Not sure about </br> though as that doesn't exist in HTML, only <br>
Blockzilla
BlockzillaOP2y ago
any names? and yes i did mean <br>
Testersen™
Testersen™2y ago
You could probably do something similar to what I did with https://deno.land/x/stx https://deno.land/x/stx@0.1.1/syntax.ts?source#L9
Blockzilla
BlockzillaOP2y ago
interesting, ill take a look at some point ended up solving my issue with regex, since there are only two tags and there wasnt much else was trying to avoid using regex for it gonna live with the &amp things for now

Did you find this page helpful?