go_editorjs

package module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 13, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

README

Go EditorJS

This package is designed to give you an interface between the open source editorjs project and Golang. If you're serving data between editorjs and a web server in Go, this package will simplify that interaction.

Inspiration

This package was inspired by other open source technology. A handful of functions were inspired and a majority were developed by yours truly to support the apario-reader and apario-writer applications.

License

This software is licensed under Apache 2.0 and can be used according to that license.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromString

func FromString(input string) (template.JS, error)

func HTML

func HTML(input string, options ...Options) string

func Markdown

func Markdown(input string, options ...Options) string

Types

type Block

type Block struct {
	Type string `json:"type"`
	Data Data   `json:"data"`
}

type Data

type Data struct {
	Text           string     `json:"text",omitempty`
	Level          int        `json:"level,omitempty" `
	Style          string     `json:"style,omitempty" `
	Items          []string   `json:"items,omitempty" `
	File           FileData   `json:"file,omitempty" `
	Caption        string     `json:"caption,omitempty"`
	WithBorder     bool       `json:"withBorder,omitempty"`
	Stretched      bool       `json:"stretched,omitempty"`
	WithBackground bool       `json:"withBackground,omitempty"`
	HTML           string     `json:"html,omitempty"`
	Content        [][]string `json:"content,omitempty"`
	Alignment      string     `json:"alignment,omitempty"`
}

type EditorJS

type EditorJS struct {
	Blocks []Block `json:"blocks"`
}

func ParseEditorJSON

func ParseEditorJSON(editorJS string) EditorJS

type FileData

type FileData struct {
	URL string `json:"url"`
}

type ImageClasses

type ImageClasses struct {
	WithBorder     string
	Stretched      string
	WithBackground string
}

type ImageOptions

type ImageOptions struct {
	Classes ImageClasses
	Caption string
}

type Options

type Options struct {
	Image ImageOptions
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL