Skip to content

Commit

Permalink
refs #14, customizable marks (#23)
Browse files Browse the repository at this point in the history
Co-authored-by: Dylan Schiemann <[email protected]>
  • Loading branch information
dylans and dylans authored Dec 26, 2020
1 parent d675f96 commit cd23a65
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/deserialize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ export interface NodeTypes {
5?: string;
6?: string;
};
emphasis_mark?: string;
strong_mark?: string;
delete_mark?: string;
}

export interface OptionType {
Expand Down Expand Up @@ -52,6 +55,9 @@ export const defaultNodeTypes = {
5: 'heading_five',
6: 'heading_six',
},
emphasis_mark: 'italic',
strong_mark: 'bold',
delete_mark: 'strikeThrough'
};

export default function deserialize(
Expand Down Expand Up @@ -119,19 +125,19 @@ export default function deserialize(

case 'emphasis':
return {
italic: true,
[types.emphasis_mark]: true,
...forceLeafNode(children),
...persistLeafFormats(children),
};
case 'strong':
return {
bold: true,
[types.strong_mark]: true,
...forceLeafNode(children),
...persistLeafFormats(children),
};
case 'delete':
return {
strikeThrough: true,
[types.delete_mark]: true,
...forceLeafNode(children),
...persistLeafFormats(children),
};
Expand Down

0 comments on commit cd23a65

Please sign in to comment.