Is there a Go Library for "forum-style" post formatting?

Hi everyone,

I need to build a feature that allows the user of my website to enter a “forums-style” formatted post or comment. They need to be allowed to make text bold, insert headlines (a bit like H1, H2 etc), insert images, denote paragraphs etc.

A few examples:
[B]Bold text[B]
[IMG]url-to-image-here[IMG]
[H]Headline[H]
etc

My website would then render this Post/Comment to HTML based on the tags above, when displaying the page.

I’m about to start coding my own implementation and then thought I should ask here first if something like this exists. I’m a little bit worried about JavaScript/HTML injection into this formatting-engine from a security point of view.

Is there anything such as this which already exists?

Thanks!

Looks like “bbcode”, first hit on google was https://github.com/frustra/bbcode

Though if you prefer markdown, there seems to be https://github.com/yuin/goldmark as another first hit on google.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.