@atlaskit/editor-wikimarkup-transformer 9.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2299 -0
- package/LICENSE +13 -0
- package/build/tsconfig.json +17 -0
- package/char/package.json +7 -0
- package/dist/cjs/char.js +8 -0
- package/dist/cjs/encoder/emoji-unicode-mapping.js +1618 -0
- package/dist/cjs/encoder/index.js +76 -0
- package/dist/cjs/encoder/marks/__base.js +24 -0
- package/dist/cjs/encoder/marks/code.js +12 -0
- package/dist/cjs/encoder/marks/color.js +12 -0
- package/dist/cjs/encoder/marks/em.js +19 -0
- package/dist/cjs/encoder/marks/link.js +12 -0
- package/dist/cjs/encoder/marks/strike.js +14 -0
- package/dist/cjs/encoder/marks/strong.js +18 -0
- package/dist/cjs/encoder/marks/subsup.js +18 -0
- package/dist/cjs/encoder/marks/underline.js +14 -0
- package/dist/cjs/encoder/nodes/block-card.js +18 -0
- package/dist/cjs/encoder/nodes/blockquote.js +21 -0
- package/dist/cjs/encoder/nodes/bullet-list.js +21 -0
- package/dist/cjs/encoder/nodes/code-block.js +27 -0
- package/dist/cjs/encoder/nodes/date.js +21 -0
- package/dist/cjs/encoder/nodes/decisionItem.js +23 -0
- package/dist/cjs/encoder/nodes/decisionList.js +18 -0
- package/dist/cjs/encoder/nodes/doc.js +21 -0
- package/dist/cjs/encoder/nodes/embed-card.js +18 -0
- package/dist/cjs/encoder/nodes/emoji.js +26 -0
- package/dist/cjs/encoder/nodes/expand.js +22 -0
- package/dist/cjs/encoder/nodes/hard-break.js +12 -0
- package/dist/cjs/encoder/nodes/heading.js +18 -0
- package/dist/cjs/encoder/nodes/inline-card.js +26 -0
- package/dist/cjs/encoder/nodes/inlines.js +44 -0
- package/dist/cjs/encoder/nodes/listItem.js +77 -0
- package/dist/cjs/encoder/nodes/media-group.js +24 -0
- package/dist/cjs/encoder/nodes/media.js +66 -0
- package/dist/cjs/encoder/nodes/mention.js +27 -0
- package/dist/cjs/encoder/nodes/ordered-list.js +21 -0
- package/dist/cjs/encoder/nodes/panel.js +29 -0
- package/dist/cjs/encoder/nodes/paragraph.js +23 -0
- package/dist/cjs/encoder/nodes/rule.js +12 -0
- package/dist/cjs/encoder/nodes/status.js +43 -0
- package/dist/cjs/encoder/nodes/table.js +77 -0
- package/dist/cjs/encoder/nodes/taskItem.js +32 -0
- package/dist/cjs/encoder/nodes/taskList.js +27 -0
- package/dist/cjs/encoder/nodes/text.js +67 -0
- package/dist/cjs/encoder/nodes/unknown.js +17 -0
- package/dist/cjs/index.js +93 -0
- package/dist/cjs/interfaces.js +5 -0
- package/dist/cjs/parser/abstract-tree.js +44 -0
- package/dist/cjs/parser/builder/list-builder.js +350 -0
- package/dist/cjs/parser/builder/table-builder.js +156 -0
- package/dist/cjs/parser/color.js +13 -0
- package/dist/cjs/parser/error.js +22 -0
- package/dist/cjs/parser/nodes/mediaGroup.js +25 -0
- package/dist/cjs/parser/nodes/mediaSingle.js +107 -0
- package/dist/cjs/parser/nodes/paragraph.js +72 -0
- package/dist/cjs/parser/nodes/rule.js +27 -0
- package/dist/cjs/parser/nodes/text.js +15 -0
- package/dist/cjs/parser/text.js +165 -0
- package/dist/cjs/parser/tokenize/adf-macro.js +49 -0
- package/dist/cjs/parser/tokenize/anchor-macro.js +31 -0
- package/dist/cjs/parser/tokenize/blockquote.js +42 -0
- package/dist/cjs/parser/tokenize/citation.js +71 -0
- package/dist/cjs/parser/tokenize/code-macro.js +95 -0
- package/dist/cjs/parser/tokenize/color-macro.js +64 -0
- package/dist/cjs/parser/tokenize/common-formatter.js +230 -0
- package/dist/cjs/parser/tokenize/common-macro.js +62 -0
- package/dist/cjs/parser/tokenize/dash-token-creator.js +42 -0
- package/dist/cjs/parser/tokenize/deleted.js +66 -0
- package/dist/cjs/parser/tokenize/double-dash-symbol.js +30 -0
- package/dist/cjs/parser/tokenize/emoji.js +184 -0
- package/dist/cjs/parser/tokenize/emphasis.js +65 -0
- package/dist/cjs/parser/tokenize/file-link.js +36 -0
- package/dist/cjs/parser/tokenize/force-line-break.js +48 -0
- package/dist/cjs/parser/tokenize/hardbreak.js +33 -0
- package/dist/cjs/parser/tokenize/heading.js +70 -0
- package/dist/cjs/parser/tokenize/index.js +144 -0
- package/dist/cjs/parser/tokenize/inserted.js +65 -0
- package/dist/cjs/parser/tokenize/issue-key.js +107 -0
- package/dist/cjs/parser/tokenize/keyword.js +159 -0
- package/dist/cjs/parser/tokenize/link-text.js +77 -0
- package/dist/cjs/parser/tokenize/links/attachment-link.js +18 -0
- package/dist/cjs/parser/tokenize/links/issue-link.js +41 -0
- package/dist/cjs/parser/tokenize/links/link-format.js +65 -0
- package/dist/cjs/parser/tokenize/links/link-parser.js +224 -0
- package/dist/cjs/parser/tokenize/links/link-resolver.js +57 -0
- package/dist/cjs/parser/tokenize/links/mention-link.js +24 -0
- package/dist/cjs/parser/tokenize/links/url-link.js +64 -0
- package/dist/cjs/parser/tokenize/list.js +339 -0
- package/dist/cjs/parser/tokenize/media.js +51 -0
- package/dist/cjs/parser/tokenize/monospace.js +59 -0
- package/dist/cjs/parser/tokenize/noformat-macro.js +46 -0
- package/dist/cjs/parser/tokenize/panel-macro.js +106 -0
- package/dist/cjs/parser/tokenize/quadruple-dash-symbol.js +30 -0
- package/dist/cjs/parser/tokenize/quote-macro.js +166 -0
- package/dist/cjs/parser/tokenize/ruler.js +33 -0
- package/dist/cjs/parser/tokenize/strong.js +65 -0
- package/dist/cjs/parser/tokenize/subscript.js +67 -0
- package/dist/cjs/parser/tokenize/superscript.js +67 -0
- package/dist/cjs/parser/tokenize/table.js +353 -0
- package/dist/cjs/parser/tokenize/triple-dash-symbol.js +30 -0
- package/dist/cjs/parser/tokenize/whitespace.js +56 -0
- package/dist/cjs/parser/utils/attrs.js +33 -0
- package/dist/cjs/parser/utils/color-name-mapping.js +700 -0
- package/dist/cjs/parser/utils/escape.js +36 -0
- package/dist/cjs/parser/utils/normalize.js +209 -0
- package/dist/cjs/parser/utils/panel-type.js +120 -0
- package/dist/cjs/parser/utils/text.js +98 -0
- package/dist/cjs/parser/utils/title.js +17 -0
- package/dist/cjs/parser/utils/url.js +31 -0
- package/dist/cjs/version.json +5 -0
- package/dist/es2019/char.js +1 -0
- package/dist/es2019/encoder/emoji-unicode-mapping.js +1611 -0
- package/dist/es2019/encoder/index.js +51 -0
- package/dist/es2019/encoder/marks/__base.js +15 -0
- package/dist/es2019/encoder/marks/code.js +3 -0
- package/dist/es2019/encoder/marks/color.js +3 -0
- package/dist/es2019/encoder/marks/em.js +9 -0
- package/dist/es2019/encoder/marks/link.js +3 -0
- package/dist/es2019/encoder/marks/strike.js +4 -0
- package/dist/es2019/encoder/marks/strong.js +9 -0
- package/dist/es2019/encoder/marks/subsup.js +8 -0
- package/dist/es2019/encoder/marks/underline.js +4 -0
- package/dist/es2019/encoder/nodes/block-card.js +8 -0
- package/dist/es2019/encoder/nodes/blockquote.js +10 -0
- package/dist/es2019/encoder/nodes/bullet-list.js +10 -0
- package/dist/es2019/encoder/nodes/code-block.js +16 -0
- package/dist/es2019/encoder/nodes/date.js +12 -0
- package/dist/es2019/encoder/nodes/decisionItem.js +12 -0
- package/dist/es2019/encoder/nodes/decisionList.js +8 -0
- package/dist/es2019/encoder/nodes/doc.js +10 -0
- package/dist/es2019/encoder/nodes/embed-card.js +8 -0
- package/dist/es2019/encoder/nodes/emoji.js +15 -0
- package/dist/es2019/encoder/nodes/expand.js +11 -0
- package/dist/es2019/encoder/nodes/hard-break.js +3 -0
- package/dist/es2019/encoder/nodes/heading.js +8 -0
- package/dist/es2019/encoder/nodes/inline-card.js +15 -0
- package/dist/es2019/encoder/nodes/inlines.js +26 -0
- package/dist/es2019/encoder/nodes/listItem.js +63 -0
- package/dist/es2019/encoder/nodes/media-group.js +13 -0
- package/dist/es2019/encoder/nodes/media.js +54 -0
- package/dist/es2019/encoder/nodes/mention.js +16 -0
- package/dist/es2019/encoder/nodes/ordered-list.js +10 -0
- package/dist/es2019/encoder/nodes/panel.js +19 -0
- package/dist/es2019/encoder/nodes/paragraph.js +12 -0
- package/dist/es2019/encoder/nodes/rule.js +3 -0
- package/dist/es2019/encoder/nodes/status.js +23 -0
- package/dist/es2019/encoder/nodes/table.js +62 -0
- package/dist/es2019/encoder/nodes/taskItem.js +21 -0
- package/dist/es2019/encoder/nodes/taskList.js +17 -0
- package/dist/es2019/encoder/nodes/text.js +46 -0
- package/dist/es2019/encoder/nodes/unknown.js +8 -0
- package/dist/es2019/index.js +58 -0
- package/dist/es2019/interfaces.js +1 -0
- package/dist/es2019/parser/abstract-tree.js +23 -0
- package/dist/es2019/parser/builder/list-builder.js +294 -0
- package/dist/es2019/parser/builder/table-builder.js +135 -0
- package/dist/es2019/parser/color.js +5 -0
- package/dist/es2019/parser/error.js +15 -0
- package/dist/es2019/parser/nodes/mediaGroup.js +18 -0
- package/dist/es2019/parser/nodes/mediaSingle.js +95 -0
- package/dist/es2019/parser/nodes/paragraph.js +43 -0
- package/dist/es2019/parser/nodes/rule.js +21 -0
- package/dist/es2019/parser/nodes/text.js +8 -0
- package/dist/es2019/parser/text.js +145 -0
- package/dist/es2019/parser/tokenize/adf-macro.js +40 -0
- package/dist/es2019/parser/tokenize/anchor-macro.js +22 -0
- package/dist/es2019/parser/tokenize/blockquote.js +26 -0
- package/dist/es2019/parser/tokenize/citation.js +53 -0
- package/dist/es2019/parser/tokenize/code-macro.js +57 -0
- package/dist/es2019/parser/tokenize/color-macro.js +46 -0
- package/dist/es2019/parser/tokenize/common-formatter.js +215 -0
- package/dist/es2019/parser/tokenize/common-macro.js +48 -0
- package/dist/es2019/parser/tokenize/dash-token-creator.js +31 -0
- package/dist/es2019/parser/tokenize/deleted.js +49 -0
- package/dist/es2019/parser/tokenize/double-dash-symbol.js +11 -0
- package/dist/es2019/parser/tokenize/emoji.js +174 -0
- package/dist/es2019/parser/tokenize/emphasis.js +48 -0
- package/dist/es2019/parser/tokenize/file-link.js +25 -0
- package/dist/es2019/parser/tokenize/force-line-break.js +38 -0
- package/dist/es2019/parser/tokenize/hardbreak.js +24 -0
- package/dist/es2019/parser/tokenize/heading.js +58 -0
- package/dist/es2019/parser/tokenize/index.js +129 -0
- package/dist/es2019/parser/tokenize/inserted.js +48 -0
- package/dist/es2019/parser/tokenize/issue-key.js +81 -0
- package/dist/es2019/parser/tokenize/keyword.js +142 -0
- package/dist/es2019/parser/tokenize/link-text.js +65 -0
- package/dist/es2019/parser/tokenize/links/attachment-link.js +8 -0
- package/dist/es2019/parser/tokenize/links/issue-link.js +35 -0
- package/dist/es2019/parser/tokenize/links/link-format.js +52 -0
- package/dist/es2019/parser/tokenize/links/link-parser.js +208 -0
- package/dist/es2019/parser/tokenize/links/link-resolver.js +39 -0
- package/dist/es2019/parser/tokenize/links/mention-link.js +17 -0
- package/dist/es2019/parser/tokenize/links/url-link.js +49 -0
- package/dist/es2019/parser/tokenize/list.js +296 -0
- package/dist/es2019/parser/tokenize/media.js +30 -0
- package/dist/es2019/parser/tokenize/monospace.js +47 -0
- package/dist/es2019/parser/tokenize/noformat-macro.js +37 -0
- package/dist/es2019/parser/tokenize/panel-macro.js +63 -0
- package/dist/es2019/parser/tokenize/quadruple-dash-symbol.js +22 -0
- package/dist/es2019/parser/tokenize/quote-macro.js +129 -0
- package/dist/es2019/parser/tokenize/ruler.js +23 -0
- package/dist/es2019/parser/tokenize/strong.js +48 -0
- package/dist/es2019/parser/tokenize/subscript.js +50 -0
- package/dist/es2019/parser/tokenize/superscript.js +50 -0
- package/dist/es2019/parser/tokenize/table.js +333 -0
- package/dist/es2019/parser/tokenize/triple-dash-symbol.js +11 -0
- package/dist/es2019/parser/tokenize/whitespace.js +45 -0
- package/dist/es2019/parser/utils/attrs.js +17 -0
- package/dist/es2019/parser/utils/color-name-mapping.js +693 -0
- package/dist/es2019/parser/utils/escape.js +28 -0
- package/dist/es2019/parser/utils/normalize.js +161 -0
- package/dist/es2019/parser/utils/panel-type.js +109 -0
- package/dist/es2019/parser/utils/text.js +58 -0
- package/dist/es2019/parser/utils/title.js +10 -0
- package/dist/es2019/parser/utils/url.js +24 -0
- package/dist/es2019/version.json +5 -0
- package/dist/esm/char.js +1 -0
- package/dist/esm/encoder/emoji-unicode-mapping.js +1611 -0
- package/dist/esm/encoder/index.js +51 -0
- package/dist/esm/encoder/marks/__base.js +15 -0
- package/dist/esm/encoder/marks/code.js +3 -0
- package/dist/esm/encoder/marks/color.js +3 -0
- package/dist/esm/encoder/marks/em.js +9 -0
- package/dist/esm/encoder/marks/link.js +3 -0
- package/dist/esm/encoder/marks/strike.js +4 -0
- package/dist/esm/encoder/marks/strong.js +9 -0
- package/dist/esm/encoder/marks/subsup.js +8 -0
- package/dist/esm/encoder/marks/underline.js +4 -0
- package/dist/esm/encoder/nodes/block-card.js +8 -0
- package/dist/esm/encoder/nodes/blockquote.js +11 -0
- package/dist/esm/encoder/nodes/bullet-list.js +11 -0
- package/dist/esm/encoder/nodes/code-block.js +16 -0
- package/dist/esm/encoder/nodes/date.js +12 -0
- package/dist/esm/encoder/nodes/decisionItem.js +13 -0
- package/dist/esm/encoder/nodes/decisionList.js +8 -0
- package/dist/esm/encoder/nodes/doc.js +11 -0
- package/dist/esm/encoder/nodes/embed-card.js +8 -0
- package/dist/esm/encoder/nodes/emoji.js +15 -0
- package/dist/esm/encoder/nodes/expand.js +12 -0
- package/dist/esm/encoder/nodes/hard-break.js +3 -0
- package/dist/esm/encoder/nodes/heading.js +8 -0
- package/dist/esm/encoder/nodes/inline-card.js +15 -0
- package/dist/esm/encoder/nodes/inlines.js +26 -0
- package/dist/esm/encoder/nodes/listItem.js +63 -0
- package/dist/esm/encoder/nodes/media-group.js +14 -0
- package/dist/esm/encoder/nodes/media.js +57 -0
- package/dist/esm/encoder/nodes/mention.js +19 -0
- package/dist/esm/encoder/nodes/ordered-list.js +11 -0
- package/dist/esm/encoder/nodes/panel.js +18 -0
- package/dist/esm/encoder/nodes/paragraph.js +13 -0
- package/dist/esm/encoder/nodes/rule.js +3 -0
- package/dist/esm/encoder/nodes/status.js +29 -0
- package/dist/esm/encoder/nodes/table.js +66 -0
- package/dist/esm/encoder/nodes/taskItem.js +22 -0
- package/dist/esm/encoder/nodes/taskList.js +18 -0
- package/dist/esm/encoder/nodes/text.js +51 -0
- package/dist/esm/encoder/nodes/unknown.js +6 -0
- package/dist/esm/index.js +78 -0
- package/dist/esm/interfaces.js +1 -0
- package/dist/esm/parser/abstract-tree.js +34 -0
- package/dist/esm/parser/builder/list-builder.js +338 -0
- package/dist/esm/parser/builder/table-builder.js +150 -0
- package/dist/esm/parser/color.js +5 -0
- package/dist/esm/parser/error.js +15 -0
- package/dist/esm/parser/nodes/mediaGroup.js +18 -0
- package/dist/esm/parser/nodes/mediaSingle.js +97 -0
- package/dist/esm/parser/nodes/paragraph.js +61 -0
- package/dist/esm/parser/nodes/rule.js +18 -0
- package/dist/esm/parser/nodes/text.js +8 -0
- package/dist/esm/parser/text.js +149 -0
- package/dist/esm/parser/tokenize/adf-macro.js +39 -0
- package/dist/esm/parser/tokenize/anchor-macro.js +21 -0
- package/dist/esm/parser/tokenize/blockquote.js +28 -0
- package/dist/esm/parser/tokenize/citation.js +54 -0
- package/dist/esm/parser/tokenize/code-macro.js +80 -0
- package/dist/esm/parser/tokenize/color-macro.js +46 -0
- package/dist/esm/parser/tokenize/common-formatter.js +216 -0
- package/dist/esm/parser/tokenize/common-macro.js +52 -0
- package/dist/esm/parser/tokenize/dash-token-creator.js +33 -0
- package/dist/esm/parser/tokenize/deleted.js +50 -0
- package/dist/esm/parser/tokenize/double-dash-symbol.js +19 -0
- package/dist/esm/parser/tokenize/emoji.js +173 -0
- package/dist/esm/parser/tokenize/emphasis.js +49 -0
- package/dist/esm/parser/tokenize/file-link.js +25 -0
- package/dist/esm/parser/tokenize/force-line-break.js +38 -0
- package/dist/esm/parser/tokenize/hardbreak.js +23 -0
- package/dist/esm/parser/tokenize/heading.js +58 -0
- package/dist/esm/parser/tokenize/index.js +102 -0
- package/dist/esm/parser/tokenize/inserted.js +49 -0
- package/dist/esm/parser/tokenize/issue-key.js +89 -0
- package/dist/esm/parser/tokenize/keyword.js +142 -0
- package/dist/esm/parser/tokenize/link-text.js +64 -0
- package/dist/esm/parser/tokenize/links/attachment-link.js +8 -0
- package/dist/esm/parser/tokenize/links/issue-link.js +33 -0
- package/dist/esm/parser/tokenize/links/link-format.js +51 -0
- package/dist/esm/parser/tokenize/links/link-parser.js +213 -0
- package/dist/esm/parser/tokenize/links/link-resolver.js +55 -0
- package/dist/esm/parser/tokenize/links/mention-link.js +17 -0
- package/dist/esm/parser/tokenize/links/url-link.js +50 -0
- package/dist/esm/parser/tokenize/list.js +318 -0
- package/dist/esm/parser/tokenize/media.js +36 -0
- package/dist/esm/parser/tokenize/monospace.js +47 -0
- package/dist/esm/parser/tokenize/noformat-macro.js +34 -0
- package/dist/esm/parser/tokenize/panel-macro.js +88 -0
- package/dist/esm/parser/tokenize/quadruple-dash-symbol.js +21 -0
- package/dist/esm/parser/tokenize/quote-macro.js +148 -0
- package/dist/esm/parser/tokenize/ruler.js +22 -0
- package/dist/esm/parser/tokenize/strong.js +49 -0
- package/dist/esm/parser/tokenize/subscript.js +51 -0
- package/dist/esm/parser/tokenize/superscript.js +51 -0
- package/dist/esm/parser/tokenize/table.js +336 -0
- package/dist/esm/parser/tokenize/triple-dash-symbol.js +19 -0
- package/dist/esm/parser/tokenize/whitespace.js +45 -0
- package/dist/esm/parser/utils/attrs.js +23 -0
- package/dist/esm/parser/utils/color-name-mapping.js +693 -0
- package/dist/esm/parser/utils/escape.js +28 -0
- package/dist/esm/parser/utils/normalize.js +195 -0
- package/dist/esm/parser/utils/panel-type.js +109 -0
- package/dist/esm/parser/utils/text.js +81 -0
- package/dist/esm/parser/utils/title.js +10 -0
- package/dist/esm/parser/utils/url.js +24 -0
- package/dist/esm/version.json +5 -0
- package/dist/types/char.d.ts +1 -0
- package/dist/types/encoder/emoji-unicode-mapping.d.ts +3 -0
- package/dist/types/encoder/index.d.ts +9 -0
- package/dist/types/encoder/marks/__base.d.ts +5 -0
- package/dist/types/encoder/marks/code.d.ts +2 -0
- package/dist/types/encoder/marks/color.d.ts +2 -0
- package/dist/types/encoder/marks/em.d.ts +2 -0
- package/dist/types/encoder/marks/link.d.ts +2 -0
- package/dist/types/encoder/marks/strike.d.ts +2 -0
- package/dist/types/encoder/marks/strong.d.ts +6 -0
- package/dist/types/encoder/marks/subsup.d.ts +2 -0
- package/dist/types/encoder/marks/underline.d.ts +2 -0
- package/dist/types/encoder/nodes/block-card.d.ts +2 -0
- package/dist/types/encoder/nodes/blockquote.d.ts +2 -0
- package/dist/types/encoder/nodes/bullet-list.d.ts +2 -0
- package/dist/types/encoder/nodes/code-block.d.ts +2 -0
- package/dist/types/encoder/nodes/date.d.ts +2 -0
- package/dist/types/encoder/nodes/decisionItem.d.ts +3 -0
- package/dist/types/encoder/nodes/decisionList.d.ts +2 -0
- package/dist/types/encoder/nodes/doc.d.ts +2 -0
- package/dist/types/encoder/nodes/embed-card.d.ts +2 -0
- package/dist/types/encoder/nodes/emoji.d.ts +2 -0
- package/dist/types/encoder/nodes/expand.d.ts +2 -0
- package/dist/types/encoder/nodes/hard-break.d.ts +2 -0
- package/dist/types/encoder/nodes/heading.d.ts +2 -0
- package/dist/types/encoder/nodes/inline-card.d.ts +2 -0
- package/dist/types/encoder/nodes/inlines.d.ts +2 -0
- package/dist/types/encoder/nodes/listItem.d.ts +3 -0
- package/dist/types/encoder/nodes/media-group.d.ts +2 -0
- package/dist/types/encoder/nodes/media.d.ts +2 -0
- package/dist/types/encoder/nodes/mention.d.ts +2 -0
- package/dist/types/encoder/nodes/ordered-list.d.ts +2 -0
- package/dist/types/encoder/nodes/panel.d.ts +2 -0
- package/dist/types/encoder/nodes/paragraph.d.ts +2 -0
- package/dist/types/encoder/nodes/rule.d.ts +2 -0
- package/dist/types/encoder/nodes/status.d.ts +2 -0
- package/dist/types/encoder/nodes/table.d.ts +2 -0
- package/dist/types/encoder/nodes/taskItem.d.ts +3 -0
- package/dist/types/encoder/nodes/taskList.d.ts +2 -0
- package/dist/types/encoder/nodes/text.d.ts +2 -0
- package/dist/types/encoder/nodes/unknown.d.ts +2 -0
- package/dist/types/index.d.ts +15 -0
- package/dist/types/interfaces.d.ts +68 -0
- package/dist/types/parser/abstract-tree.d.ts +11 -0
- package/dist/types/parser/builder/list-builder.d.ts +66 -0
- package/dist/types/parser/builder/table-builder.d.ts +45 -0
- package/dist/types/parser/color.d.ts +3 -0
- package/dist/types/parser/error.d.ts +1 -0
- package/dist/types/parser/nodes/mediaGroup.d.ts +3 -0
- package/dist/types/parser/nodes/mediaSingle.d.ts +5 -0
- package/dist/types/parser/nodes/paragraph.d.ts +7 -0
- package/dist/types/parser/nodes/rule.d.ts +3 -0
- package/dist/types/parser/nodes/text.d.ts +2 -0
- package/dist/types/parser/text.d.ts +10 -0
- package/dist/types/parser/tokenize/adf-macro.d.ts +2 -0
- package/dist/types/parser/tokenize/anchor-macro.d.ts +2 -0
- package/dist/types/parser/tokenize/blockquote.d.ts +2 -0
- package/dist/types/parser/tokenize/citation.d.ts +2 -0
- package/dist/types/parser/tokenize/code-macro.d.ts +2 -0
- package/dist/types/parser/tokenize/color-macro.d.ts +2 -0
- package/dist/types/parser/tokenize/common-formatter.d.ts +10 -0
- package/dist/types/parser/tokenize/common-macro.d.ts +10 -0
- package/dist/types/parser/tokenize/dash-token-creator.d.ts +2 -0
- package/dist/types/parser/tokenize/deleted.d.ts +2 -0
- package/dist/types/parser/tokenize/double-dash-symbol.d.ts +1 -0
- package/dist/types/parser/tokenize/emoji.d.ts +15 -0
- package/dist/types/parser/tokenize/emphasis.d.ts +2 -0
- package/dist/types/parser/tokenize/file-link.d.ts +3 -0
- package/dist/types/parser/tokenize/force-line-break.d.ts +2 -0
- package/dist/types/parser/tokenize/hardbreak.d.ts +2 -0
- package/dist/types/parser/tokenize/heading.d.ts +2 -0
- package/dist/types/parser/tokenize/index.d.ts +55 -0
- package/dist/types/parser/tokenize/inserted.d.ts +2 -0
- package/dist/types/parser/tokenize/issue-key.d.ts +20 -0
- package/dist/types/parser/tokenize/keyword.d.ts +13 -0
- package/dist/types/parser/tokenize/link-text.d.ts +3 -0
- package/dist/types/parser/tokenize/links/attachment-link.d.ts +4 -0
- package/dist/types/parser/tokenize/links/issue-link.d.ts +4 -0
- package/dist/types/parser/tokenize/links/link-format.d.ts +2 -0
- package/dist/types/parser/tokenize/links/link-parser.d.ts +17 -0
- package/dist/types/parser/tokenize/links/link-resolver.d.ts +5 -0
- package/dist/types/parser/tokenize/links/mention-link.d.ts +4 -0
- package/dist/types/parser/tokenize/links/url-link.d.ts +4 -0
- package/dist/types/parser/tokenize/list.d.ts +3 -0
- package/dist/types/parser/tokenize/media.d.ts +2 -0
- package/dist/types/parser/tokenize/monospace.d.ts +2 -0
- package/dist/types/parser/tokenize/noformat-macro.d.ts +2 -0
- package/dist/types/parser/tokenize/panel-macro.d.ts +2 -0
- package/dist/types/parser/tokenize/quadruple-dash-symbol.d.ts +2 -0
- package/dist/types/parser/tokenize/quote-macro.d.ts +5 -0
- package/dist/types/parser/tokenize/ruler.d.ts +2 -0
- package/dist/types/parser/tokenize/strong.d.ts +2 -0
- package/dist/types/parser/tokenize/subscript.d.ts +2 -0
- package/dist/types/parser/tokenize/superscript.d.ts +2 -0
- package/dist/types/parser/tokenize/table.d.ts +2 -0
- package/dist/types/parser/tokenize/triple-dash-symbol.d.ts +1 -0
- package/dist/types/parser/tokenize/whitespace.d.ts +3 -0
- package/dist/types/parser/utils/attrs.d.ts +3 -0
- package/dist/types/parser/utils/color-name-mapping.d.ts +10 -0
- package/dist/types/parser/utils/escape.d.ts +2 -0
- package/dist/types/parser/utils/normalize.d.ts +4 -0
- package/dist/types/parser/utils/panel-type.d.ts +3 -0
- package/dist/types/parser/utils/text.d.ts +21 -0
- package/dist/types/parser/utils/title.d.ts +7 -0
- package/dist/types/parser/utils/url.d.ts +8 -0
- package/docs/0-intro.tsx +24 -0
- package/interfaces/package.json +7 -0
- package/package.json +53 -0
- package/tsconfig.json +12 -0
- package/typings/json.d.ts +1 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.monospace = void 0;
|
|
7
|
+
|
|
8
|
+
var _ = require("./");
|
|
9
|
+
|
|
10
|
+
var _commonFormatter = require("./common-formatter");
|
|
11
|
+
|
|
12
|
+
var _text = require("../text");
|
|
13
|
+
|
|
14
|
+
var monospace = function monospace(_ref) {
|
|
15
|
+
var input = _ref.input,
|
|
16
|
+
position = _ref.position,
|
|
17
|
+
schema = _ref.schema,
|
|
18
|
+
context = _ref.context;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* The following token types will be ignored in parsing
|
|
22
|
+
* the content
|
|
23
|
+
*/
|
|
24
|
+
var ignoreTokenTypes = [_.TokenType.ADF_MACRO, _.TokenType.ANCHOR_MACRO, _.TokenType.CODE_MACRO, _.TokenType.QUOTE_MACRO, _.TokenType.NOFORMAT_MACRO, _.TokenType.PANEL_MACRO, _.TokenType.COLOR_MACRO, _.TokenType.LOREM_MACRO, _.TokenType.QUOTE, _.TokenType.STRING, _.TokenType.ISSUE_KEY, _.TokenType.LINK_FORMAT, _.TokenType.LINK_TEXT, _.TokenType.MEDIA, _.TokenType.HEADING, _.TokenType.LIST, _.TokenType.TABLE, _.TokenType.RULER, _.TokenType.HARD_BREAK, _.TokenType.DOUBLE_DASH_SYMBOL, _.TokenType.TRIPLE_DASH_SYMBOL, _.TokenType.QUADRUPLE_DASH_SYMBOL, _.TokenType.STRONG, _.TokenType.MONOSPACE, _.TokenType.SUPERSCRIPT, _.TokenType.SUBSCRIPT, _.TokenType.EMPHASIS, _.TokenType.CITATION, _.TokenType.DELETED, _.TokenType.INSERTED, _.TokenType.EMOJI, _.TokenType.FORCE_LINE_BREAK]; // Add code mark to each text
|
|
25
|
+
|
|
26
|
+
var contentDecorator = function contentDecorator(n) {
|
|
27
|
+
var mark = schema.marks.code.create(); // We don't want to mix `code` mark with others
|
|
28
|
+
|
|
29
|
+
if (n.type.name === 'text' && n.marks.length) {
|
|
30
|
+
return n;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return n.mark([mark]);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
var rawContentProcessor = function rawContentProcessor(raw, length) {
|
|
37
|
+
var content = (0, _text.parseString)({
|
|
38
|
+
ignoreTokenTypes: ignoreTokenTypes,
|
|
39
|
+
schema: schema,
|
|
40
|
+
context: context,
|
|
41
|
+
input: raw
|
|
42
|
+
});
|
|
43
|
+
var decoratedContent = content.map(contentDecorator);
|
|
44
|
+
return {
|
|
45
|
+
type: 'pmnode',
|
|
46
|
+
nodes: decoratedContent,
|
|
47
|
+
length: length
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
return (0, _commonFormatter.commonFormatter)(input, position, schema, {
|
|
52
|
+
opening: '{{',
|
|
53
|
+
closing: '}}',
|
|
54
|
+
context: context,
|
|
55
|
+
rawContentProcessor: rawContentProcessor
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
exports.monospace = monospace;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.noformatMacro = void 0;
|
|
7
|
+
|
|
8
|
+
var _commonMacro = require("./common-macro");
|
|
9
|
+
|
|
10
|
+
var _attrs = require("../utils/attrs");
|
|
11
|
+
|
|
12
|
+
var _title = require("../utils/title");
|
|
13
|
+
|
|
14
|
+
var noformatMacro = function noformatMacro(_ref) {
|
|
15
|
+
var input = _ref.input,
|
|
16
|
+
position = _ref.position,
|
|
17
|
+
schema = _ref.schema,
|
|
18
|
+
context = _ref.context;
|
|
19
|
+
return (0, _commonMacro.commonMacro)(input.substring(position), schema, {
|
|
20
|
+
keyword: 'noformat',
|
|
21
|
+
paired: true,
|
|
22
|
+
context: context,
|
|
23
|
+
rawContentProcessor: rawContentProcessor
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
exports.noformatMacro = noformatMacro;
|
|
28
|
+
|
|
29
|
+
var rawContentProcessor = function rawContentProcessor(rawAttrs, rawContent, length, schema, _context) {
|
|
30
|
+
var output = [];
|
|
31
|
+
var codeBlock = schema.nodes.codeBlock;
|
|
32
|
+
var parsedAttrs = (0, _attrs.parseAttrs)(rawAttrs);
|
|
33
|
+
var trimedContent = rawContent.replace(/^\s+|\s+$/g, '');
|
|
34
|
+
var textNode = trimedContent.length ? schema.text(trimedContent) : undefined;
|
|
35
|
+
|
|
36
|
+
if (parsedAttrs.title) {
|
|
37
|
+
output.push((0, _title.title)(parsedAttrs.title, schema));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
output.push(codeBlock.createChecked({}, textNode));
|
|
41
|
+
return {
|
|
42
|
+
type: 'pmnode',
|
|
43
|
+
nodes: output,
|
|
44
|
+
length: length
|
|
45
|
+
};
|
|
46
|
+
};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.panelMacro = void 0;
|
|
9
|
+
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
|
|
12
|
+
var _commonMacro = require("./common-macro");
|
|
13
|
+
|
|
14
|
+
var _text = require("../text");
|
|
15
|
+
|
|
16
|
+
var _attrs = require("../utils/attrs");
|
|
17
|
+
|
|
18
|
+
var _normalize = require("../utils/normalize");
|
|
19
|
+
|
|
20
|
+
var _panelType = require("../utils/panel-type");
|
|
21
|
+
|
|
22
|
+
var _title = require("../utils/title");
|
|
23
|
+
|
|
24
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
25
|
+
|
|
26
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
27
|
+
|
|
28
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
29
|
+
|
|
30
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
31
|
+
|
|
32
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
33
|
+
|
|
34
|
+
var allowedNodeType = ['paragraph', 'heading', 'orderedList', 'bulletList'];
|
|
35
|
+
|
|
36
|
+
var panelMacro = function panelMacro(_ref) {
|
|
37
|
+
var input = _ref.input,
|
|
38
|
+
position = _ref.position,
|
|
39
|
+
schema = _ref.schema,
|
|
40
|
+
context = _ref.context;
|
|
41
|
+
return (0, _commonMacro.commonMacro)(input.substring(position), schema, {
|
|
42
|
+
keyword: 'panel',
|
|
43
|
+
paired: true,
|
|
44
|
+
context: context,
|
|
45
|
+
rawContentProcessor: rawContentProcessor
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
exports.panelMacro = panelMacro;
|
|
50
|
+
|
|
51
|
+
var rawContentProcessor = function rawContentProcessor(rawAttrs, rawContent, length, schema, context) {
|
|
52
|
+
var output = [];
|
|
53
|
+
var parsedAttrs = (0, _attrs.parseAttrs)(rawAttrs);
|
|
54
|
+
|
|
55
|
+
var nodeAttrs = _objectSpread(_objectSpread({}, parsedAttrs), {}, {
|
|
56
|
+
panelType: (0, _panelType.getPanelType)(parsedAttrs)
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
var parsedContent = (0, _text.parseString)({
|
|
60
|
+
schema: schema,
|
|
61
|
+
context: context,
|
|
62
|
+
ignoreTokenTypes: [],
|
|
63
|
+
input: rawContent
|
|
64
|
+
});
|
|
65
|
+
var normalizedContent = (0, _normalize.normalizePMNodes)(parsedContent, schema);
|
|
66
|
+
var contentBuffer = parsedAttrs.title ? [(0, _title.title)(parsedAttrs.title, schema)] : [];
|
|
67
|
+
|
|
68
|
+
var _iterator = _createForOfIteratorHelper(normalizedContent),
|
|
69
|
+
_step;
|
|
70
|
+
|
|
71
|
+
try {
|
|
72
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
73
|
+
var n = _step.value;
|
|
74
|
+
|
|
75
|
+
if (allowedNodeType.indexOf(n.type.name) !== -1) {
|
|
76
|
+
contentBuffer.push(n);
|
|
77
|
+
} else {
|
|
78
|
+
var _panelNode = schema.nodes.panel.createChecked(nodeAttrs, contentBuffer.length ? contentBuffer : schema.nodes.paragraph.createChecked());
|
|
79
|
+
|
|
80
|
+
contentBuffer = [];
|
|
81
|
+
output.push(_panelNode);
|
|
82
|
+
output.push(n);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
} catch (err) {
|
|
86
|
+
_iterator.e(err);
|
|
87
|
+
} finally {
|
|
88
|
+
_iterator.f();
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (contentBuffer.length > 0) {
|
|
92
|
+
var panelNode = schema.nodes.panel.createChecked(nodeAttrs, contentBuffer);
|
|
93
|
+
output.push(panelNode);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return {
|
|
97
|
+
type: 'pmnode',
|
|
98
|
+
nodes: output.length ? output : [emptyPanel(schema)],
|
|
99
|
+
length: length
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
function emptyPanel(schema) {
|
|
104
|
+
var p = schema.nodes.paragraph.createChecked();
|
|
105
|
+
return schema.nodes.panel.createChecked({}, p);
|
|
106
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.quadrupleDashSymbol = void 0;
|
|
7
|
+
var MULTI_DASH_REGEX = /^-{4,}(\s|$)/;
|
|
8
|
+
|
|
9
|
+
var quadrupleDashSymbol = function quadrupleDashSymbol(_ref) {
|
|
10
|
+
var input = _ref.input,
|
|
11
|
+
position = _ref.position;
|
|
12
|
+
// This won't be a ruler because ruler has been checked at leadingKeywordMapping
|
|
13
|
+
var match = input.substring(position).match(MULTI_DASH_REGEX);
|
|
14
|
+
|
|
15
|
+
if (!match) {
|
|
16
|
+
return {
|
|
17
|
+
type: 'text',
|
|
18
|
+
text: '----',
|
|
19
|
+
length: 4
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return {
|
|
24
|
+
type: 'text',
|
|
25
|
+
text: input.substr(position, match[0].length),
|
|
26
|
+
length: match[0].length
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
exports.quadrupleDashSymbol = quadrupleDashSymbol;
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.rawContentProcessor = exports.quoteMacro = void 0;
|
|
9
|
+
|
|
10
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
11
|
+
|
|
12
|
+
var _commonMacro = require("./common-macro");
|
|
13
|
+
|
|
14
|
+
var _text = require("../utils/text");
|
|
15
|
+
|
|
16
|
+
var _normalize = require("../utils/normalize");
|
|
17
|
+
|
|
18
|
+
var _text2 = require("../text");
|
|
19
|
+
|
|
20
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
21
|
+
|
|
22
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
23
|
+
|
|
24
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
25
|
+
|
|
26
|
+
var quoteMacro = function quoteMacro(_ref) {
|
|
27
|
+
var input = _ref.input,
|
|
28
|
+
position = _ref.position,
|
|
29
|
+
schema = _ref.schema,
|
|
30
|
+
context = _ref.context;
|
|
31
|
+
return (0, _commonMacro.commonMacro)(input.substring(position), schema, {
|
|
32
|
+
keyword: 'quote',
|
|
33
|
+
paired: true,
|
|
34
|
+
rawContentProcessor: rawContentProcessor,
|
|
35
|
+
context: context
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
exports.quoteMacro = quoteMacro;
|
|
40
|
+
|
|
41
|
+
var rawContentProcessor = function rawContentProcessor(_rawAttrs, rawContent, length, schema, context) {
|
|
42
|
+
if (!rawContent.length) {
|
|
43
|
+
var emptyQuote = emptyBlockquote(schema);
|
|
44
|
+
return {
|
|
45
|
+
type: 'pmnode',
|
|
46
|
+
nodes: [emptyQuote],
|
|
47
|
+
length: length
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
var parsedContent = (0, _text2.parseString)({
|
|
52
|
+
schema: schema,
|
|
53
|
+
context: context,
|
|
54
|
+
ignoreTokenTypes: [],
|
|
55
|
+
input: rawContent
|
|
56
|
+
});
|
|
57
|
+
var normalizedContent = (0, _normalize.normalizePMNodes)(parsedContent, schema);
|
|
58
|
+
return {
|
|
59
|
+
type: 'pmnode',
|
|
60
|
+
nodes: sanitize(normalizedContent, schema),
|
|
61
|
+
length: length
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
exports.rawContentProcessor = rawContentProcessor;
|
|
66
|
+
|
|
67
|
+
function emptyBlockquote(schema) {
|
|
68
|
+
var p = schema.nodes.paragraph.createChecked({}, []);
|
|
69
|
+
return schema.nodes.blockquote.createChecked({}, p);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function sanitize(nodes, schema) {
|
|
73
|
+
var output = [];
|
|
74
|
+
var contentBuffer = [];
|
|
75
|
+
|
|
76
|
+
var _iterator = _createForOfIteratorHelper(nodes),
|
|
77
|
+
_step;
|
|
78
|
+
|
|
79
|
+
try {
|
|
80
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
81
|
+
var n = _step.value;
|
|
82
|
+
|
|
83
|
+
switch (n.type.name) {
|
|
84
|
+
case 'paragraph':
|
|
85
|
+
{
|
|
86
|
+
/**
|
|
87
|
+
* blockquote is happy with paragraph
|
|
88
|
+
*/
|
|
89
|
+
contentBuffer.push(n);
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
case 'heading':
|
|
94
|
+
{
|
|
95
|
+
/**
|
|
96
|
+
* If a heading is inside a list item
|
|
97
|
+
* - h1. Bold, Uppercase
|
|
98
|
+
* - h2. Bold, Italic
|
|
99
|
+
* - h3. Bold
|
|
100
|
+
* - h4. Bold, Gray
|
|
101
|
+
* - h5. Gray, Italic
|
|
102
|
+
* - h6. Gray
|
|
103
|
+
*/
|
|
104
|
+
contentBuffer.push(transformHeading(n, schema));
|
|
105
|
+
break;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
default:
|
|
109
|
+
/**
|
|
110
|
+
* Anything else should be lifted
|
|
111
|
+
*/
|
|
112
|
+
if (contentBuffer.length) {
|
|
113
|
+
var _blockquote = schema.nodes.blockquote.createChecked({}, contentBuffer);
|
|
114
|
+
|
|
115
|
+
output.push(_blockquote);
|
|
116
|
+
contentBuffer = [];
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
output.push(n);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
} catch (err) {
|
|
123
|
+
_iterator.e(err);
|
|
124
|
+
} finally {
|
|
125
|
+
_iterator.f();
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
if (contentBuffer.length) {
|
|
129
|
+
var blockquote = schema.nodes.blockquote.createChecked({}, contentBuffer);
|
|
130
|
+
output.push(blockquote);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
return output;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function transformHeading(heading, schema) {
|
|
137
|
+
var contentBuffer = [];
|
|
138
|
+
heading.content.forEach(function (n) {
|
|
139
|
+
var strong = schema.marks.strong.create();
|
|
140
|
+
var italic = schema.marks.em.create();
|
|
141
|
+
var gray = schema.marks.textColor.create({
|
|
142
|
+
color: '#97a0af'
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
if (n.type.name === 'text') {
|
|
146
|
+
if (n.text && heading.attrs.level === 1) {
|
|
147
|
+
n.text = n.text.toUpperCase();
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
if (heading.attrs.level <= 4 && !(0, _text.hasAnyOfMarks)(n, ['strong', 'code'])) {
|
|
151
|
+
n = n.mark([].concat((0, _toConsumableArray2.default)(n.marks), [strong]));
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if ((heading.attrs.level === 5 || heading.attrs.level === 2) && !(0, _text.hasAnyOfMarks)(n, ['em', 'code'])) {
|
|
155
|
+
n = n.mark([].concat((0, _toConsumableArray2.default)(n.marks), [italic]));
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
if (heading.attrs.level > 3 && !(0, _text.hasAnyOfMarks)(n, ['textColor', 'code'])) {
|
|
159
|
+
n = n.mark([].concat((0, _toConsumableArray2.default)(n.marks), [gray]));
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
contentBuffer.push(n);
|
|
164
|
+
});
|
|
165
|
+
return schema.nodes.paragraph.createChecked({}, contentBuffer);
|
|
166
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ruler = void 0;
|
|
7
|
+
|
|
8
|
+
var _rule = require("../nodes/rule");
|
|
9
|
+
|
|
10
|
+
var RULER_REGEX = /^-{4,5}(\s|$)/;
|
|
11
|
+
|
|
12
|
+
var ruler = function ruler(_ref) {
|
|
13
|
+
var input = _ref.input,
|
|
14
|
+
position = _ref.position,
|
|
15
|
+
schema = _ref.schema;
|
|
16
|
+
var match = input.substring(position).match(RULER_REGEX);
|
|
17
|
+
|
|
18
|
+
if (match) {
|
|
19
|
+
return {
|
|
20
|
+
type: 'pmnode',
|
|
21
|
+
nodes: (0, _rule.createRuleNode)(schema),
|
|
22
|
+
length: match[0].length
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return {
|
|
27
|
+
type: 'text',
|
|
28
|
+
text: input.substring(position, 1),
|
|
29
|
+
length: 1
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
exports.ruler = ruler;
|