Skip to content

Commit 18dd2cd

Browse files
committed
chore(doc) Fixes comments and README for new version
Signed-off-by: Jerome Simeon <[email protected]>
1 parent f39ed6d commit 18dd2cd

File tree

3 files changed

+52
-57
lines changed

3 files changed

+52
-57
lines changed

packages/markdown-slate/README.md

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,13 @@
11
# Slate Transformer
22

3-
Use `SlateTransformer` to transform a CiceroMark DOM to/from a Slate DOM.
3+
Use `SlateTransformer` to transform a CiceroMark DOM to/from a JSON representation for the Slate DOM (version 0.4x.x).
44

55
## Installation
66

77
```
88
npm install @accordproject/markdown-slate --save
99
```
1010

11-
You'll also need to be sure to install this package's peer dependencies:
12-
```
13-
npm install slate immutable
14-
```
15-
1611
## Usage
1712

1813
``` javascript

packages/markdown-slate/src/SlateTransformer.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ class SlateTransformer {
3232

3333
/**
3434
* Converts a CiceroMark DOM to a Slate DOM
35-
* @param {*} input CiceroMark DOM
36-
* @returns {*} Slate DOM
35+
* @param {*} input - CiceroMark DOM
36+
* @returns {*} Slate JSON
3737
*/
3838
fromCiceroMark(input) {
3939

@@ -91,9 +91,9 @@ class SlateTransformer {
9191
}
9292

9393
/**
94-
* Converts a Slate value document node to CiceroMark DOM
95-
* @param {*} value - Slate value
96-
* @param {string} [format] result format, defaults to 'concerto'. Pass
94+
* Converts a Slate JSON to CiceroMark DOM
95+
* @param {*} value - Slate json
96+
* @param {string} [format] - result format, defaults to 'concerto'. Pass
9797
* 'json' to return the JSON data.
9898
* @returns {*} the CiceroMark DOM
9999
*/
@@ -110,9 +110,9 @@ class SlateTransformer {
110110
}
111111

112112
/**
113-
* Converts a Slate DOM to a markdown string
114-
* @param {*} value Slate value
115-
* @param {object} [options] configuration options
113+
* Converts a Slate JSON to a markdown string
114+
* @param {*} value - Slate json
115+
* @param {object} [options] - configuration options
116116
* @returns {*} markdown string
117117
*/
118118
toMarkdown(value, options) {
@@ -121,9 +121,9 @@ class SlateTransformer {
121121
}
122122

123123
/**
124-
* Converts a markdown string to a Slate DOM
125-
* @param {string} markdown a markdown string
126-
* @returns {*} Slate value
124+
* Converts a markdown string to a Slate JSON
125+
* @param {string} markdown - a markdown string
126+
* @returns {*} Slate json
127127
*/
128128
fromMarkdown(markdown) {
129129
const ciceroMarkDom = this.ciceroMarkTransformer.fromMarkdown(markdown, 'json');

packages/markdown-slate/src/ToSlateVisitor.js

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -226,51 +226,51 @@ class ToSlateVisitor {
226226
break;
227227
case 'Heading':
228228
result = {
229-
'object': 'block',
230-
'data': {},
231-
'type': ToSlateVisitor.getHeadingType(thing),
232-
'nodes': this.processChildNodes(thing,parameters)
229+
object: 'block',
230+
data: {},
231+
type: ToSlateVisitor.getHeadingType(thing),
232+
nodes: this.processChildNodes(thing,parameters)
233233
};
234234
break;
235235
case 'ThematicBreak':
236236
result = {
237-
'object': 'block',
238-
'type': 'horizontal_rule',
239-
'nodes': []
237+
object: 'block',
238+
type: 'horizontal_rule',
239+
nodes: []
240240
};
241241
break;
242242
case 'Linebreak':
243243
result = {
244-
'object': 'inline',
245-
'type': 'linebreak'
244+
object: 'inline',
245+
type: 'linebreak'
246246
};
247247
break;
248248
case 'Softbreak':
249249
result = {
250-
'object': 'inline',
251-
'type': 'softbreak'
250+
object: 'inline',
251+
type: 'softbreak'
252252
};
253253
break;
254254
case 'Link':
255255
result = {
256-
'object': 'inline',
257-
'type': 'link',
258-
'data': {
259-
'href': thing.destination,
260-
'title': thing.title ? thing.title : ''
256+
object: 'inline',
257+
type: 'link',
258+
data: {
259+
href: thing.destination,
260+
title: thing.title ? thing.title : ''
261261
},
262-
'nodes': this.processChildNodes(thing,parameters)
262+
nodes: this.processChildNodes(thing,parameters)
263263
};
264264
break;
265265
case 'Image':
266266
result = {
267-
'object': 'inline',
268-
'type': 'image',
269-
'data': {
267+
object: 'inline',
268+
type: 'image',
269+
data: {
270270
'href': thing.destination,
271271
'title': thing.title ? thing.title : ''
272272
},
273-
'nodes': [
273+
nodes: [
274274
{
275275
'object': 'text',
276276
'text': thing.text ? thing.text : '',
@@ -281,10 +281,10 @@ class ToSlateVisitor {
281281
break;
282282
case 'Paragraph':
283283
result = {
284-
'object': 'block',
285-
'type': 'paragraph',
286-
'nodes': this.processChildNodes(thing,parameters),
287-
'data': {}
284+
object: 'block',
285+
type: 'paragraph',
286+
nodes: this.processChildNodes(thing,parameters),
287+
data: {}
288288
};
289289
break;
290290
case 'HtmlBlock':
@@ -322,34 +322,34 @@ class ToSlateVisitor {
322322
break;
323323
case 'List':
324324
result = {
325-
'object': 'block',
326-
'data': { tight: thing.tight, start: thing.start, delimiter: thing.delimiter},
327-
'type': thing.type === 'ordered' ? 'ol_list' : 'ul_list',
328-
'nodes': this.processChildNodes(thing,parameters)
325+
object: 'block',
326+
data: { tight: thing.tight, start: thing.start, delimiter: thing.delimiter},
327+
type: thing.type === 'ordered' ? 'ol_list' : 'ul_list',
328+
nodes: this.processChildNodes(thing,parameters)
329329
};
330330
break;
331331
case 'ListVariable':
332332
/* XXX Will have to be changed to support editing of dynamic lists in the UI */
333333
result = {
334-
'object': 'block',
335-
'data': { tight: thing.tight, start: thing.start, delimiter: thing.delimiter, kind: 'variable' },
336-
'type': thing.type === 'ordered' ? 'ol_list' : 'ul_list',
337-
'nodes': this.processChildNodes(thing,parameters)
334+
object: 'block',
335+
data: { tight: thing.tight, start: thing.start, delimiter: thing.delimiter, kind: 'variable' },
336+
type: thing.type === 'ordered' ? 'ol_list' : 'ul_list',
337+
nodes: this.processChildNodes(thing,parameters)
338338
};
339339
break;
340340
case 'Item':
341341
result = {
342-
'object': 'block',
343-
'type': 'list_item',
344-
'data': {},
345-
'nodes': this.processChildNodes(thing,parameters)
342+
object: 'block',
343+
type: 'list_item',
344+
data: {},
345+
nodes: this.processChildNodes(thing,parameters)
346346
};
347347
break;
348348
case 'Document':
349349
result = {
350-
'object': 'document',
351-
'nodes': this.processChildNodes(thing,parameters),
352-
'data' : {}
350+
object: 'document',
351+
nodes: this.processChildNodes(thing,parameters),
352+
data : {}
353353
};
354354
break;
355355
default:

0 commit comments

Comments
 (0)