editorjs-go-paragraph is an official plugin for editorjs-go that provides rendering support for Editor.js paragraph blocks into safe HTML output.
- ✅ Escapes HTML entities to prevent injection
- ✅ Simple, single-purpose plugin for
paragraphblocks - 🧩 Plug-and-play integration with
editorjs-go
Install the plugin along with editorjs-go:
go get github.com/christiandenisi/editorjs-go
go get github.com/christiandenisi/editorjs-go-paragraphpackage main
import (
"fmt"
"github.com/christiandenisi/editorjs-go"
"github.com/christiandenisi/editorjs-go-plugin-paragraph/paragraph"
)
func main() {
jsonData := []byte(`{
"time": 1234567890,
"version": "2.27.0",
"blocks": [
{
"type": "paragraph",
"data": { "text": "Hello <world>" }
}
]
}`)
conv := editorjs.New()
editorjs.Register(conv, "paragraph", paragraph.RenderParagraph)
html, err := conv.Convert(jsonData)
if err != nil {
panic(err)
}
fmt.Println(html)
}- Escaping is handled via
html.EscapeString(...), so raw HTML won't be injected.
This plugin is compatible with:
editorjs-goversion1.x
MIT – free to use, modify, and distribute.