Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/nicksrandall/prosemirror-go

This will export ProseMirror content state to HTML, Plain Text, or Markdown
https://github.com/nicksrandall/prosemirror-go

prosemirror

Last synced: 3 months ago
JSON representation

This will export ProseMirror content state to HTML, Plain Text, or Markdown

Awesome Lists containing this project

README

        

# prosemirror-go
[![GoDoc](https://godoc.org/github.com/nicksrandall/prosemirror-go?status.svg)](https://godoc.org/github.com/nicksrandall/prosemirror-go)
[![Build Status](https://travis-ci.org/nicksrandall/prosemirror-go.svg?branch=master)](https://travis-ci.org/nicksrandall/prosemirror-go)

This will export ProseMirror content state to HTML, Plain Text, or Markdown

## Usage

```go
func Export(rawContentState []byte) (string, error) {
state := prosemirror.ContentState{}

if err := json.Unmarshall(rawContentState, &state); err != nil {
return "", err
}

config := prosemirror.NewHTMLConfig() // Export HTML
// config := prosemirror.NewMarkdownConfig() // Export Markdown
// config := prosemirror.NewPlainTextConfig() // Export Plain Text

html := prosemirror.Render(&state, config)
return html, nil
}

```