Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dchenk/go-render-quill
Render Quill insert Delta operations to HTML
https://github.com/dchenk/go-render-quill
go quill quill-delta quilljs
Last synced: about 1 month ago
JSON representation
Render Quill insert Delta operations to HTML
- Host: GitHub
- URL: https://github.com/dchenk/go-render-quill
- Owner: dchenk
- License: mit
- Created: 2017-12-31T18:45:39.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2023-04-01T00:54:21.000Z (over 1 year ago)
- Last Synced: 2024-08-02T09:22:19.100Z (4 months ago)
- Topics: go, quill, quill-delta, quilljs
- Language: Go
- Size: 35.2 KB
- Stars: 39
- Watchers: 6
- Forks: 15
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-quill - go-render-quill - A Go package to render Quill deltas into HTML (Uncategorized / Uncategorized)
README
# go-render-quill
[![Build Status](https://travis-ci.org/dchenk/go-render-quill.svg?branch=master)](https://travis-ci.org/dchenk/go-render-quill)
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fdchenk%2Fgo-render-quill.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fdchenk%2Fgo-render-quill?ref=badge_shield)Package `quill` takes a Quill-based Delta (https://github.com/quilljs/delta) as a JSON array of `insert` operations
and renders the defined HTML document.Complete documentation at GoDoc: [https://godoc.org/github.com/dchenk/go-render-quill](https://godoc.org/github.com/dchenk/go-render-quill)
## Usage
```go
import "github.com/dchenk/go-render-quill"var delta = `[{"insert":"This "},{"attributes":{"italic":true},"insert":"is"},
{"insert":" "},{"attributes":{"bold":true},"insert":"great!"},{"insert":"\n"}]`html, err := quill.Render(delta)
if err != nil {
panic(err)
}
fmt.Println(string(html))
// Output:This is great!
```## Supported Formats
### Inline
- Background color
- Bold
- Text color
- Italic
- Link
- Size
- Strikethrough
- Superscript/Subscript
- Underline### Block
- Blockquote
- Header
- Indent
- List (ul and ol, including nested lists)
- Text alignment
- Code block### Embeds
- Image (an inline format)## Extending
The simple `Formatter` interface is all you need to implement for most block and inline formats. Instead of `Render` use `RenderExtended`
and provide a function that returns a `Formatter` for inserts that have the format you need.For more control, you can also implement `FormatWriter` or `FormatWrapper`.