Skip to content

christiandenisi/editorjs-go-paragraph

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EDITORJS GO PARAGRAPH

editorjs-go-paragraph is an official plugin for editorjs-go that provides rendering support for Editor.js paragraph blocks into safe HTML output.

✨ Features

  • ✅ Escapes HTML entities to prevent injection
  • ✅ Simple, single-purpose plugin for paragraph blocks
  • 🧩 Plug-and-play integration with editorjs-go

📦 Installation

Install the plugin along with editorjs-go:

go get github.com/christiandenisi/editorjs-go
go get github.com/christiandenisi/editorjs-go-paragraph

🚀 Usage

Register the plugin in your main converter and convert

package 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)
}

📌 Notes

  • Escaping is handled via html.EscapeString(...), so raw HTML won't be injected.

🧱 Compatibility

This plugin is compatible with:

  • editorjs-go version 1.x

👤 License

MIT – free to use, modify, and distribute.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages