lucid-markup
lucid-markup is a Go renderer that combines CommonMark/GFM Markdown with
the safe BBCode renderer from lucid-bbcode. It converts either format to
HTML and preserves the legacy [markdown]...[/markdown] BBCode extension for
embedding Markdown inside UBB content.
The module requires Go 1.26.5.
Install
go get github.com/msg7086/lucid-markup@v1.0.0
Usage
package main
import (
"fmt"
markup "github.com/msg7086/lucid-markup"
)
func main() {
markdownHTML, err := markup.Render(
markup.FormatMarkdown,
"## Heading\n\n~~done~~",
)
if err != nil {
panic(err)
}
bbcodeHTML, err := markup.Render(
markup.FormatBBCode,
"[b]bold[/b]",
)
if err != nil {
panic(err)
}
nestedHTML, err := markup.Render(
markup.FormatBBCode,
"[quote][markdown]**Markdown inside UBB**[/markdown][/quote]",
)
if err != nil {
panic(err)
}
fmt.Println(markdownHTML, bbcodeHTML, nestedHTML)
}
Render returns ErrUnsupportedFormat when the input format is unknown.
Markdown uses Goldmark's CommonMark and GFM extensions. Raw HTML and unsafe
link destinations are not emitted. BBCode rendering is delegated to
lucid-bbcode, which applies its own escaping and URL safety rules.
License
MIT. See LICENSE.