@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,19 @@
|
|
|
1
|
+
var PREFIX = 'accountid:';
|
|
2
|
+
var UNKNOWN_USER = 'UNKNOWN_USER';
|
|
3
|
+
|
|
4
|
+
var addPrefix = function addPrefix(content) {
|
|
5
|
+
return content.toLowerCase().startsWith(PREFIX) ? content : "".concat(PREFIX).concat(content);
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export var mention = function mention(node) {
|
|
9
|
+
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
10
|
+
context = _ref.context;
|
|
11
|
+
|
|
12
|
+
if (node.attrs.id === UNKNOWN_USER) {
|
|
13
|
+
return "[~".concat(node.attrs.id, "]");
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
var mentionKey = node.attrs.id.toLowerCase();
|
|
17
|
+
var content = context && context.conversion && context.conversion.mentionConversion && context.conversion.mentionConversion[mentionKey] ? context.conversion.mentionConversion[mentionKey] : addPrefix(node.attrs.id);
|
|
18
|
+
return "[~".concat(content, "]");
|
|
19
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { listItem } from './listItem';
|
|
2
|
+
export var orderedList = function orderedList(node) {
|
|
3
|
+
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
4
|
+
context = _ref.context;
|
|
5
|
+
|
|
6
|
+
var result = [];
|
|
7
|
+
node.forEach(function (item) {
|
|
8
|
+
result.push(listItem(item, '#', context));
|
|
9
|
+
});
|
|
10
|
+
return result.join('\n');
|
|
11
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { encode } from '..';
|
|
2
|
+
var panelTypeColorMapping = {
|
|
3
|
+
info: '#deebff',
|
|
4
|
+
note: '#eae6ff',
|
|
5
|
+
success: '#e3fcef',
|
|
6
|
+
warning: '#fffae6',
|
|
7
|
+
error: '#ffebe6'
|
|
8
|
+
};
|
|
9
|
+
export var panel = function panel(node) {
|
|
10
|
+
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
11
|
+
context = _ref.context;
|
|
12
|
+
|
|
13
|
+
var result = [];
|
|
14
|
+
node.forEach(function (n) {
|
|
15
|
+
result.push(encode(n, context));
|
|
16
|
+
});
|
|
17
|
+
return "{panel:bgColor=".concat(panelTypeColorMapping[node.attrs.panelType] || '', "}\n").concat(result.join('\n\n'), "\n{panel}");
|
|
18
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { inlines } from './inlines';
|
|
2
|
+
export var paragraph = function paragraph(node) {
|
|
3
|
+
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
4
|
+
context = _ref.context;
|
|
5
|
+
|
|
6
|
+
var result = '';
|
|
7
|
+
node.forEach(function (n) {
|
|
8
|
+
result += inlines(n, {
|
|
9
|
+
context: context
|
|
10
|
+
});
|
|
11
|
+
});
|
|
12
|
+
return result;
|
|
13
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
|
|
3
|
+
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; }
|
|
4
|
+
|
|
5
|
+
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) { _defineProperty(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; }
|
|
6
|
+
|
|
7
|
+
import { textColor } from '../marks/color';
|
|
8
|
+
import { N80, P300, T300, R300, Y400, G300 } from '@atlaskit/theme/colors';
|
|
9
|
+
var color = {
|
|
10
|
+
grey: N80,
|
|
11
|
+
purple: P300,
|
|
12
|
+
blue: T300,
|
|
13
|
+
red: R300,
|
|
14
|
+
yellow: Y400,
|
|
15
|
+
green: G300
|
|
16
|
+
};
|
|
17
|
+
export var status = function status(node) {
|
|
18
|
+
var text = "*[ ".concat(node.attrs.text.toUpperCase(), " ]*");
|
|
19
|
+
|
|
20
|
+
var newAttrs = _objectSpread({}, node.attrs);
|
|
21
|
+
|
|
22
|
+
if (color[node.attrs.color]) {
|
|
23
|
+
newAttrs.color = color[node.attrs.color];
|
|
24
|
+
} else {
|
|
25
|
+
newAttrs.color = color['grey'];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return textColor(text, newAttrs);
|
|
29
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { encode } from '..';
|
|
2
|
+
import { unknown } from './unknown';
|
|
3
|
+
export var table = function table(node) {
|
|
4
|
+
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
5
|
+
|
|
6
|
+
try {
|
|
7
|
+
var result = [];
|
|
8
|
+
node.forEach(function (n) {
|
|
9
|
+
result.push(tableRow(n, opts));
|
|
10
|
+
});
|
|
11
|
+
return result.join('\n');
|
|
12
|
+
} catch (err) {
|
|
13
|
+
return unknown(node);
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
var tableRow = function tableRow(node) {
|
|
18
|
+
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
19
|
+
var result = '';
|
|
20
|
+
var separator = '|';
|
|
21
|
+
node.forEach(function (n) {
|
|
22
|
+
if (n.type.name === 'tableHeader') {
|
|
23
|
+
separator = '||';
|
|
24
|
+
} else {
|
|
25
|
+
separator = '|';
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
result = "".concat(result).concat(separator).concat(tableCell(n, opts));
|
|
29
|
+
});
|
|
30
|
+
return "".concat(result).concat(separator);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
var tableCell = function tableCell(node) {
|
|
34
|
+
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
35
|
+
context = _ref.context;
|
|
36
|
+
|
|
37
|
+
if (hasMergedCell(node)) {
|
|
38
|
+
// This is an advanced table
|
|
39
|
+
throw new Error('Advanced feature of table is not supported');
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
var result = [];
|
|
43
|
+
node.forEach(function (n) {
|
|
44
|
+
result.push(encode(n, context));
|
|
45
|
+
});
|
|
46
|
+
var output = result.join('\n').trim(); // Return single whitespace if content of cell is empty
|
|
47
|
+
// to preserve correct empty cell rendering in wiki
|
|
48
|
+
|
|
49
|
+
return output === '' ? ' ' : output;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
var hasMergedCell = function hasMergedCell(node) {
|
|
53
|
+
if (!node.attrs) {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (node.attrs.colspan && node.attrs.colspan !== 1) {
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (node.attrs.rowspan && node.attrs.rowspan !== 1) {
|
|
62
|
+
return true;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return false;
|
|
66
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { inlines } from './inlines';
|
|
2
|
+
export var taskItem = function taskItem(node, nestedLevel) {
|
|
3
|
+
var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
|
|
4
|
+
context = _ref.context;
|
|
5
|
+
|
|
6
|
+
var result = '';
|
|
7
|
+
node.forEach(function (n) {
|
|
8
|
+
// Generate stars based on depth
|
|
9
|
+
var prefix = Array(nestedLevel).fill('*').join('');
|
|
10
|
+
|
|
11
|
+
if (node.attrs.state === 'DONE') {
|
|
12
|
+
result += "".concat(prefix, " -").concat(inlines(n, {
|
|
13
|
+
context: context
|
|
14
|
+
}), "-");
|
|
15
|
+
} else {
|
|
16
|
+
result += "".concat(prefix, " ").concat(inlines(n, {
|
|
17
|
+
context: context
|
|
18
|
+
}));
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
return result;
|
|
22
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { taskItem } from './taskItem';
|
|
2
|
+
|
|
3
|
+
var nestedNode = function nestedNode(node) {
|
|
4
|
+
var depth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
5
|
+
var result = [];
|
|
6
|
+
node.forEach(function (item) {
|
|
7
|
+
if (item.type.name === 'taskList') {
|
|
8
|
+
result.push(nestedNode(item, depth + 1));
|
|
9
|
+
} else {
|
|
10
|
+
result.push(taskItem(item, depth));
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
return result.join('\n');
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export var taskList = function taskList(node) {
|
|
17
|
+
return nestedNode(node);
|
|
18
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { code } from '../marks/code';
|
|
2
|
+
import { textColor } from '../marks/color';
|
|
3
|
+
import { em } from '../marks/em';
|
|
4
|
+
import { link } from '../marks/link';
|
|
5
|
+
import { strike } from '../marks/strike';
|
|
6
|
+
import { strong } from '../marks/strong';
|
|
7
|
+
import { subsup } from '../marks/subsup';
|
|
8
|
+
import { underline } from '../marks/underline';
|
|
9
|
+
/**
|
|
10
|
+
* The order of the mapping matters.
|
|
11
|
+
* For example, textColor will be a macro {color} so
|
|
12
|
+
* we want to process other marks before it.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
var markEncoderMapping = new Map([['em', em], ['strike', strike], ['strong', strong], ['subsup', subsup], ['underline', underline], ['textColor', textColor], ['link', link], ['code', code]]);
|
|
16
|
+
/**
|
|
17
|
+
* Checks if the node's content needs to be escaped before continuing processing.
|
|
18
|
+
* Currently, the `code` mark and `codeBlock` nodes handle their own escaping, and
|
|
19
|
+
* therefore, should not be escaped here.
|
|
20
|
+
*
|
|
21
|
+
* @param node the current node to encode
|
|
22
|
+
* @param parent the parent node, if exist
|
|
23
|
+
* @returns true if the node should have its text escaped when encoding to wikimarkup.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
var isEscapeNeeded = function isEscapeNeeded(node, parent) {
|
|
27
|
+
return !(parent && parent.type.name === 'codeBlock' || node.marks.find(function (m) {
|
|
28
|
+
return m.type.name === 'code';
|
|
29
|
+
}) !== undefined);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
function escapingWikiFormatter(text) {
|
|
33
|
+
return text.replace(/[{\\![]/g, '\\$&');
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export var text = function text(node) {
|
|
37
|
+
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
38
|
+
parent = _ref.parent;
|
|
39
|
+
|
|
40
|
+
var result = isEscapeNeeded(node, parent) ? escapingWikiFormatter(node.text) : node.text;
|
|
41
|
+
markEncoderMapping.forEach(function (encoder, markName) {
|
|
42
|
+
var mark = node.marks.find(function (m) {
|
|
43
|
+
return m.type.name === markName;
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
if (mark) {
|
|
47
|
+
result = encoder(result, mark.attrs);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
return result;
|
|
51
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { JSONTransformer } from '@atlaskit/editor-json-transformer';
|
|
2
|
+
var jsonTransformer = new JSONTransformer();
|
|
3
|
+
export var unknown = function unknown(node) {
|
|
4
|
+
var content = JSON.stringify(jsonTransformer.encodeNode(node));
|
|
5
|
+
return node.isBlock ? "{adf:display=block}\n".concat(content, "\n{adf}") : "{adf:display=inline}".concat(content, "{adf}");
|
|
6
|
+
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
|
+
|
|
5
|
+
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; }
|
|
6
|
+
|
|
7
|
+
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) { _defineProperty(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; }
|
|
8
|
+
|
|
9
|
+
import { defaultSchema } from '@atlaskit/adf-schema';
|
|
10
|
+
import { encode as _encode } from './encoder';
|
|
11
|
+
import AbstractTree from './parser/abstract-tree';
|
|
12
|
+
import { buildIssueKeyRegex } from './parser/tokenize/issue-key';
|
|
13
|
+
export var WikiMarkupTransformer = /*#__PURE__*/function () {
|
|
14
|
+
function WikiMarkupTransformer() {
|
|
15
|
+
var schema = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultSchema;
|
|
16
|
+
|
|
17
|
+
_classCallCheck(this, WikiMarkupTransformer);
|
|
18
|
+
|
|
19
|
+
this.schema = schema;
|
|
20
|
+
} // [ADFS-725] Jira breaks if there are null chars it is easier to remove them here
|
|
21
|
+
// The following has to be a regex to remove all instances of null instead of the first
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
_createClass(WikiMarkupTransformer, [{
|
|
25
|
+
key: "sanitizeWikiMarkup",
|
|
26
|
+
value: function sanitizeWikiMarkup(wikiMarkup) {
|
|
27
|
+
return wikiMarkup.replace(/\0/g, '');
|
|
28
|
+
}
|
|
29
|
+
}, {
|
|
30
|
+
key: "encode",
|
|
31
|
+
value: function encode(node, context) {
|
|
32
|
+
var wikiMarkup = _encode(node, normalizeContextObject(context)); // [ADFS-725] Jira breaks if there are null chars it is easier to remove them here
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
var sanitizedWikiMarkup = this.sanitizeWikiMarkup(wikiMarkup);
|
|
36
|
+
return sanitizedWikiMarkup;
|
|
37
|
+
}
|
|
38
|
+
}, {
|
|
39
|
+
key: "parse",
|
|
40
|
+
value: function parse(wikiMarkup, context) {
|
|
41
|
+
// [ADFS-725] Jira breaks if there are null chars it is easier to remove them here
|
|
42
|
+
var sanitizedWikiMarkup = this.sanitizeWikiMarkup(wikiMarkup);
|
|
43
|
+
var tree = new AbstractTree(this.schema, sanitizedWikiMarkup);
|
|
44
|
+
return tree.getProseMirrorModel(this.buildContext(normalizeContextObject(context)));
|
|
45
|
+
}
|
|
46
|
+
}, {
|
|
47
|
+
key: "buildContext",
|
|
48
|
+
value: function buildContext(context) {
|
|
49
|
+
return context ? _objectSpread(_objectSpread({}, context), {}, {
|
|
50
|
+
issueKeyRegex: context.conversion ? buildIssueKeyRegex(context.conversion.inlineCardConversion) : undefined
|
|
51
|
+
}) : {};
|
|
52
|
+
}
|
|
53
|
+
}]);
|
|
54
|
+
|
|
55
|
+
return WikiMarkupTransformer;
|
|
56
|
+
}();
|
|
57
|
+
/**
|
|
58
|
+
* Turns mentionConversion object keys to lowercase for case insensitivity matching
|
|
59
|
+
* This is okay, because conversion context object contains mapping and that should be case insensitive
|
|
60
|
+
*/
|
|
61
|
+
|
|
62
|
+
var normalizeContextObject = function normalizeContextObject(context) {
|
|
63
|
+
if (!context || !context.conversion || !context.conversion.mentionConversion) {
|
|
64
|
+
// nothing to normalize, return original object
|
|
65
|
+
return context;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
var mentionConversion = {};
|
|
69
|
+
|
|
70
|
+
for (var key in context.conversion.mentionConversion) {
|
|
71
|
+
mentionConversion[key.toLowerCase()] = context.conversion.mentionConversion[key];
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
context.conversion.mentionConversion = mentionConversion;
|
|
75
|
+
return context;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export default WikiMarkupTransformer;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
+
import { parseString } from './text';
|
|
4
|
+
import { normalizePMNodes } from './utils/normalize';
|
|
5
|
+
|
|
6
|
+
var AbstractTree = /*#__PURE__*/function () {
|
|
7
|
+
function AbstractTree(schema, wikiMarkup) {
|
|
8
|
+
_classCallCheck(this, AbstractTree);
|
|
9
|
+
|
|
10
|
+
this.schema = schema;
|
|
11
|
+
this.wikiMarkup = wikiMarkup;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Convert reduced macros tree into prosemirror model tree
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
_createClass(AbstractTree, [{
|
|
19
|
+
key: "getProseMirrorModel",
|
|
20
|
+
value: function getProseMirrorModel(context) {
|
|
21
|
+
var content = parseString({
|
|
22
|
+
context: context,
|
|
23
|
+
ignoreTokenTypes: [],
|
|
24
|
+
input: this.wikiMarkup,
|
|
25
|
+
schema: this.schema
|
|
26
|
+
});
|
|
27
|
+
return this.schema.nodes.doc.createChecked({}, normalizePMNodes(content, this.schema));
|
|
28
|
+
}
|
|
29
|
+
}]);
|
|
30
|
+
|
|
31
|
+
return AbstractTree;
|
|
32
|
+
}();
|
|
33
|
+
|
|
34
|
+
export { AbstractTree as default };
|
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
+
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
5
|
+
|
|
6
|
+
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; } } }; }
|
|
7
|
+
|
|
8
|
+
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); }
|
|
9
|
+
|
|
10
|
+
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; }
|
|
11
|
+
|
|
12
|
+
var supportedContentType = ['paragraph', 'orderedList', 'bulletList', 'mediaSingle', 'codeBlock'];
|
|
13
|
+
/**
|
|
14
|
+
* Return the type of a list from the bullets
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
export function getType(bullets) {
|
|
18
|
+
return /#$/.test(bullets) ? 'orderedList' : 'bulletList';
|
|
19
|
+
}
|
|
20
|
+
export var ListBuilder = /*#__PURE__*/function () {
|
|
21
|
+
function ListBuilder(schema, bullets) {
|
|
22
|
+
var _this = this;
|
|
23
|
+
|
|
24
|
+
_classCallCheck(this, ListBuilder);
|
|
25
|
+
|
|
26
|
+
_defineProperty(this, "parseList", function (list) {
|
|
27
|
+
var listNode = _this.schema.nodes[list.type];
|
|
28
|
+
var output = [];
|
|
29
|
+
var listItemsBuffer = [];
|
|
30
|
+
|
|
31
|
+
for (var i = 0; i < list.children.length; i++) {
|
|
32
|
+
var parsedContent = _this.parseListItem(list.children[i]);
|
|
33
|
+
|
|
34
|
+
for (var j = 0; j < parsedContent.length; j++) {
|
|
35
|
+
var parsedNode = parsedContent[j];
|
|
36
|
+
|
|
37
|
+
if (parsedNode.type.name === 'listItem') {
|
|
38
|
+
listItemsBuffer.push(parsedNode);
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* If the node is not a listItem, then we need to
|
|
43
|
+
* wrap exisintg list and break out
|
|
44
|
+
*/
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
if (listItemsBuffer.length) {
|
|
48
|
+
var _list = listNode.createChecked({}, listItemsBuffer);
|
|
49
|
+
|
|
50
|
+
output.push(_list);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
output.push(parsedNode); // This is the break out node
|
|
54
|
+
|
|
55
|
+
listItemsBuffer = [];
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (listItemsBuffer.length) {
|
|
60
|
+
var _list2 = listNode.createChecked({}, listItemsBuffer);
|
|
61
|
+
|
|
62
|
+
output.push(_list2);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return output;
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
_defineProperty(this, "parseListItem", function (item) {
|
|
69
|
+
var _item$content;
|
|
70
|
+
|
|
71
|
+
var output = [];
|
|
72
|
+
|
|
73
|
+
if (!item.content) {
|
|
74
|
+
item.content = [];
|
|
75
|
+
} // Parse nested list
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
var parsedChildren = item.children.reduce(function (result, list) {
|
|
79
|
+
var parsedList = _this.parseList(list);
|
|
80
|
+
|
|
81
|
+
result.push.apply(result, _toConsumableArray(parsedList));
|
|
82
|
+
return result;
|
|
83
|
+
}, []); // Append children to the content
|
|
84
|
+
|
|
85
|
+
(_item$content = item.content).push.apply(_item$content, _toConsumableArray(parsedChildren));
|
|
86
|
+
|
|
87
|
+
var contentBuffer = [];
|
|
88
|
+
|
|
89
|
+
for (var i = 0; i < item.content.length; i++) {
|
|
90
|
+
var pmNode = item.content[i];
|
|
91
|
+
/**
|
|
92
|
+
* Skip empty paragraph
|
|
93
|
+
*/
|
|
94
|
+
|
|
95
|
+
if (pmNode.type.name === 'paragraph' && pmNode.childCount === 0) {
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
/* Skip Empty spaces after rule */
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
if (_this.isParagraphEmptyTextNode(pmNode)) {
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if (supportedContentType.indexOf(pmNode.type.name) === -1) {
|
|
106
|
+
var listItem = _this.createListItem(contentBuffer, _this.schema);
|
|
107
|
+
|
|
108
|
+
output.push(listItem);
|
|
109
|
+
output.push(pmNode);
|
|
110
|
+
contentBuffer = [];
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
contentBuffer.push(pmNode);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
if (contentBuffer.length) {
|
|
118
|
+
var _listItem = _this.createListItem(contentBuffer, _this.schema);
|
|
119
|
+
|
|
120
|
+
output.push(_listItem);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return output;
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
this.schema = schema;
|
|
127
|
+
this.root = {
|
|
128
|
+
children: [],
|
|
129
|
+
type: getType(bullets)
|
|
130
|
+
};
|
|
131
|
+
this.lastDepth = 1;
|
|
132
|
+
this.lastList = this.root;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Return the type of the base list
|
|
136
|
+
* @returns {ListType}
|
|
137
|
+
*/
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
_createClass(ListBuilder, [{
|
|
141
|
+
key: "type",
|
|
142
|
+
get: function get() {
|
|
143
|
+
return this.root.type;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Add a list item to the builder
|
|
147
|
+
* @param {AddArgs[]} items
|
|
148
|
+
*/
|
|
149
|
+
|
|
150
|
+
}, {
|
|
151
|
+
key: "add",
|
|
152
|
+
value: function add(items) {
|
|
153
|
+
var _iterator = _createForOfIteratorHelper(items),
|
|
154
|
+
_step;
|
|
155
|
+
|
|
156
|
+
try {
|
|
157
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
158
|
+
var item = _step.value;
|
|
159
|
+
var style = item.style,
|
|
160
|
+
content = item.content; // If there's no style, add to previous list item as multiline
|
|
161
|
+
|
|
162
|
+
if (style === null) {
|
|
163
|
+
this.appendToLastItem(content);
|
|
164
|
+
continue;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
var depth = style.length;
|
|
168
|
+
var type = getType(style);
|
|
169
|
+
|
|
170
|
+
if (depth > this.lastDepth) {
|
|
171
|
+
// Add children starting from last node
|
|
172
|
+
this.createNest(depth - this.lastDepth, type);
|
|
173
|
+
this.lastDepth = depth;
|
|
174
|
+
this.lastList = this.addListItem(type, content);
|
|
175
|
+
} else if (depth === this.lastDepth) {
|
|
176
|
+
// Add list item to current node
|
|
177
|
+
this.lastList = this.addListItem(type, content);
|
|
178
|
+
} else {
|
|
179
|
+
// Find node at depth and add list item
|
|
180
|
+
this.lastList = this.findAncestor(this.lastDepth - depth);
|
|
181
|
+
this.lastDepth = depth;
|
|
182
|
+
this.lastList = this.addListItem(type, content);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
} catch (err) {
|
|
186
|
+
_iterator.e(err);
|
|
187
|
+
} finally {
|
|
188
|
+
_iterator.f();
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Compile a prosemirror node from the root list
|
|
193
|
+
* @returns {PMNode[]}
|
|
194
|
+
*/
|
|
195
|
+
|
|
196
|
+
}, {
|
|
197
|
+
key: "buildPMNode",
|
|
198
|
+
value: function buildPMNode() {
|
|
199
|
+
return this.parseList(this.root);
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Build prosemirror bulletList or orderedList node
|
|
203
|
+
* @param {List} list
|
|
204
|
+
* @returns {PMNode}
|
|
205
|
+
*/
|
|
206
|
+
|
|
207
|
+
}, {
|
|
208
|
+
key: "isParagraphEmptyTextNode",
|
|
209
|
+
value:
|
|
210
|
+
/* Check if all paragraph's children nodes are text and empty */
|
|
211
|
+
function isParagraphEmptyTextNode(node) {
|
|
212
|
+
if (node.type.name !== 'paragraph' || !node.childCount) {
|
|
213
|
+
return false;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
for (var i = 0; i < node.childCount; i++) {
|
|
217
|
+
var n = node.content.child(i);
|
|
218
|
+
|
|
219
|
+
if (n.type.name !== 'text') {
|
|
220
|
+
// Paragraph contains non-text node, so not empty
|
|
221
|
+
return false;
|
|
222
|
+
} else if (n.textContent.trim() !== '') {
|
|
223
|
+
return false;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
return true;
|
|
228
|
+
}
|
|
229
|
+
}, {
|
|
230
|
+
key: "createListItem",
|
|
231
|
+
value: function createListItem(content, schema) {
|
|
232
|
+
if (content.length === 0 || ['paragraph', 'mediaSingle'].indexOf(content[0].type.name) === -1) {
|
|
233
|
+
// If the content is empty or the first element is not paragraph or mediaSingle.
|
|
234
|
+
// this likely to be a nested list where the toplevel list is empty
|
|
235
|
+
// For example: *# item 1
|
|
236
|
+
// In this case we create an empty paragraph for the top level listNode
|
|
237
|
+
content.unshift(this.schema.nodes.paragraph.createChecked());
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
return schema.nodes.listItem.createChecked({}, content);
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Add an item at the same level as the current list item
|
|
244
|
+
* @param {ListType} type
|
|
245
|
+
* @param {PMNode} content
|
|
246
|
+
* @returns {PMNode}
|
|
247
|
+
*/
|
|
248
|
+
|
|
249
|
+
}, {
|
|
250
|
+
key: "addListItem",
|
|
251
|
+
value: function addListItem(type, content) {
|
|
252
|
+
var list = this.lastList; // If the list is a different type, create a new list and add it to the parent node
|
|
253
|
+
|
|
254
|
+
if (list.type !== type) {
|
|
255
|
+
var parent = list.parent;
|
|
256
|
+
var newList = {
|
|
257
|
+
children: [],
|
|
258
|
+
type: type,
|
|
259
|
+
parent: parent
|
|
260
|
+
};
|
|
261
|
+
parent.children.push(newList);
|
|
262
|
+
this.lastList = list = newList;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
var listItem = {
|
|
266
|
+
content: content,
|
|
267
|
+
parent: list,
|
|
268
|
+
children: []
|
|
269
|
+
};
|
|
270
|
+
list.children = [].concat(_toConsumableArray(list.children), [listItem]);
|
|
271
|
+
return list;
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Append the past content to the last accessed list node (multiline entries)
|
|
275
|
+
* @param {PMNode[]} content
|
|
276
|
+
*/
|
|
277
|
+
|
|
278
|
+
}, {
|
|
279
|
+
key: "appendToLastItem",
|
|
280
|
+
value: function appendToLastItem(content) {
|
|
281
|
+
var _ref;
|
|
282
|
+
|
|
283
|
+
var children = this.lastList.children;
|
|
284
|
+
var lastItem = children[children.length - 1];
|
|
285
|
+
|
|
286
|
+
(_ref = lastItem.content).push.apply(_ref, _toConsumableArray(content));
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Created a nested list structure of N depth under the current node
|
|
290
|
+
* @param {number} depth
|
|
291
|
+
* @param {ListType} type
|
|
292
|
+
*/
|
|
293
|
+
|
|
294
|
+
}, {
|
|
295
|
+
key: "createNest",
|
|
296
|
+
value: function createNest(depth, type) {
|
|
297
|
+
while (depth-- > 0) {
|
|
298
|
+
if (this.lastList.children.length === 0) {
|
|
299
|
+
var listItem = {
|
|
300
|
+
parent: this.lastList,
|
|
301
|
+
children: []
|
|
302
|
+
};
|
|
303
|
+
this.lastList.children = [listItem];
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
var nextItem = this.lastList.children[this.lastList.children.length - 1];
|
|
307
|
+
nextItem.children = [{
|
|
308
|
+
children: [],
|
|
309
|
+
parent: nextItem,
|
|
310
|
+
type: type
|
|
311
|
+
}];
|
|
312
|
+
this.lastList = nextItem.children[0];
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* Find the Nth list ancestor of the current list
|
|
317
|
+
* @param {number} depth
|
|
318
|
+
*/
|
|
319
|
+
|
|
320
|
+
}, {
|
|
321
|
+
key: "findAncestor",
|
|
322
|
+
value: function findAncestor(depth) {
|
|
323
|
+
var list = this.lastList;
|
|
324
|
+
|
|
325
|
+
while (depth-- > 0 && list.parent) {
|
|
326
|
+
var listItem = list.parent;
|
|
327
|
+
|
|
328
|
+
if (listItem && listItem.parent) {
|
|
329
|
+
list = listItem.parent;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
return list;
|
|
334
|
+
}
|
|
335
|
+
}]);
|
|
336
|
+
|
|
337
|
+
return ListBuilder;
|
|
338
|
+
}();
|