Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tommoor/slate-md-serializer
A Markdown serializer for the Slate editor framework
https://github.com/tommoor/slate-md-serializer
editor markdown slate
Last synced: 3 months ago
JSON representation
A Markdown serializer for the Slate editor framework
- Host: GitHub
- URL: https://github.com/tommoor/slate-md-serializer
- Owner: tommoor
- License: mit
- Fork: true (netlify/slate-markdown-serializer)
- Created: 2017-04-30T17:01:36.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2020-05-24T02:11:05.000Z (over 4 years ago)
- Last Synced: 2024-11-07T18:51:47.509Z (3 months ago)
- Topics: editor, markdown, slate
- Language: JavaScript
- Homepage:
- Size: 277 KB
- Stars: 64
- Watchers: 5
- Forks: 36
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
[![npm version](https://badge.fury.io/js/slate-md-serializer.svg)](https://badge.fury.io/js/slate-md-serializer) [![CircleCI](https://circleci.com/gh/tommoor/slate-md-serializer.svg?style=svg)](https://circleci.com/gh/tommoor/slate-md-serializer)
# Slate Markdown Serializer
A Markdown serializer for the [Slate Editor](http://slatejs.org). Requires Slate 0.32+.
## renderMark
This serializer supports the following Slate marks:
```javascript
function renderMark(props) {
switch (props.mark.type) {
case 'bold':
return {props.children};
case 'code':
return{props.children}
;
case 'italic':
return {props.children};
case 'underlined':
return {props.children};
case 'deleted':
return{props.children};
case 'added':
return {props.children};
default:
}
}
```## renderNode
This serializer supports the following Slate node keys:
```javascript
function renderNode(props) {
const { attributes } = props;switch (props.node.type) {
case 'paragraph':
return ;
case 'block-quote':
return{props.children};
case 'bulleted-list':
return
- {props.children}
case 'ordered-list':
return
- {props.children}
case 'todo-list':
return
- {props.children}
case 'table':
return {props.children};
case 'table-row':
return {props.children};
case 'table-head':
return {props.children};
case 'table-cell':
return {props.children};
case 'list-item':
return
case 'horizontal-rule':
return
;
case 'code':
return
{props.children}
;
case 'image':
return ;
case 'link':
return {props.children};
case 'heading1':
return
{props.children}
;case 'heading2':
return
{props.children}
;case 'heading3':
return
{props.children}
;case 'heading4':
return
{props.children}
;case 'heading5':
return
{props.children}
;case 'heading6':
return
{props.children}
;default:
}
};
```