Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/nicksrandall/prosemirror-go
- Owner: nicksrandall
- License: mit
- Created: 2017-05-11T21:42:06.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-06-01T17:14:56.000Z (over 7 years ago)
- Last Synced: 2024-06-20T14:18:03.196Z (7 months ago)
- Topics: prosemirror
- Language: Go
- Size: 16.6 KB
- Stars: 16
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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 Texthtml := prosemirror.Render(&state, config)
return html, nil
}```