@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,39 @@
|
|
|
1
|
+
import { commonMacro } from './common-macro';
|
|
2
|
+
export var adfMacro = function adfMacro(_ref) {
|
|
3
|
+
var input = _ref.input,
|
|
4
|
+
position = _ref.position,
|
|
5
|
+
schema = _ref.schema,
|
|
6
|
+
context = _ref.context;
|
|
7
|
+
return commonMacro(input.substring(position), schema, {
|
|
8
|
+
keyword: 'adf',
|
|
9
|
+
paired: true,
|
|
10
|
+
context: context,
|
|
11
|
+
rawContentProcessor: rawContentProcessor
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
var rawContentProcessor = function rawContentProcessor(_rawAttrs, rawContent, length, schema, _context) {
|
|
16
|
+
try {
|
|
17
|
+
var json = JSON.parse(rawContent);
|
|
18
|
+
var node = schema.nodeFromJSON(json);
|
|
19
|
+
return {
|
|
20
|
+
type: 'pmnode',
|
|
21
|
+
nodes: [node],
|
|
22
|
+
length: length
|
|
23
|
+
};
|
|
24
|
+
} catch (_e) {
|
|
25
|
+
var textContent = "Invalid ADF Macro: ".concat(rawContent);
|
|
26
|
+
var textNode = rawContent.length ? schema.text(textContent) : undefined;
|
|
27
|
+
var codeBlock = schema.nodes.codeBlock;
|
|
28
|
+
|
|
29
|
+
var _node = codeBlock.create({
|
|
30
|
+
language: undefined
|
|
31
|
+
}, textNode);
|
|
32
|
+
|
|
33
|
+
return {
|
|
34
|
+
type: 'pmnode',
|
|
35
|
+
nodes: [_node],
|
|
36
|
+
length: length
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { commonMacro } from './common-macro';
|
|
2
|
+
export var anchorMacro = function anchorMacro(_ref) {
|
|
3
|
+
var input = _ref.input,
|
|
4
|
+
position = _ref.position,
|
|
5
|
+
schema = _ref.schema,
|
|
6
|
+
context = _ref.context;
|
|
7
|
+
return commonMacro(input.substring(position), schema, {
|
|
8
|
+
keyword: 'anchor',
|
|
9
|
+
paired: false,
|
|
10
|
+
context: context,
|
|
11
|
+
rawContentProcessor: rawContentProcessor
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
var rawContentProcessor = function rawContentProcessor(_rawAttrs, _rawContent, length, _schema, _context) {
|
|
16
|
+
return {
|
|
17
|
+
type: 'text',
|
|
18
|
+
text: '',
|
|
19
|
+
length: length
|
|
20
|
+
};
|
|
21
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
import { rawContentProcessor } from './quote-macro';
|
|
3
|
+
// bq. foobarbaz
|
|
4
|
+
var BLOCKQUOTE_REGEXP = /^bq\.(.*)/;
|
|
5
|
+
export var blockquote = function blockquote(_ref) {
|
|
6
|
+
var input = _ref.input,
|
|
7
|
+
position = _ref.position,
|
|
8
|
+
schema = _ref.schema,
|
|
9
|
+
context = _ref.context;
|
|
10
|
+
var match = input.substring(position).match(BLOCKQUOTE_REGEXP);
|
|
11
|
+
|
|
12
|
+
if (!match) {
|
|
13
|
+
return fallback(input, position);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
var _match = _slicedToArray(match, 2),
|
|
17
|
+
rawContent = _match[1];
|
|
18
|
+
|
|
19
|
+
return rawContentProcessor('', rawContent, match[0].length, schema, context);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
function fallback(input, position) {
|
|
23
|
+
return {
|
|
24
|
+
type: 'text',
|
|
25
|
+
text: input.substr(position, 1),
|
|
26
|
+
length: 1
|
|
27
|
+
};
|
|
28
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
+
import { TokenType } from './';
|
|
3
|
+
import { hasAnyOfMarks } from '../utils/text';
|
|
4
|
+
import { commonFormatter } from './common-formatter';
|
|
5
|
+
import { parseString } from '../text';
|
|
6
|
+
import { EM_DASH } from '../../char';
|
|
7
|
+
export var citation = function citation(_ref) {
|
|
8
|
+
var input = _ref.input,
|
|
9
|
+
position = _ref.position,
|
|
10
|
+
schema = _ref.schema,
|
|
11
|
+
context = _ref.context;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* The following token types will be ignored in parsing
|
|
15
|
+
* the content
|
|
16
|
+
*/
|
|
17
|
+
var ignoreTokenTypes = [TokenType.DOUBLE_DASH_SYMBOL, TokenType.TRIPLE_DASH_SYMBOL, TokenType.QUADRUPLE_DASH_SYMBOL, TokenType.ISSUE_KEY]; // Add code mark to each text
|
|
18
|
+
|
|
19
|
+
var contentDecorator = function contentDecorator(n, index) {
|
|
20
|
+
var mark = schema.marks.em.create(); // We don't want to mix `code` mark with others
|
|
21
|
+
|
|
22
|
+
if (n.type.name === 'text' && !hasAnyOfMarks(n, ['em', 'code'])) {
|
|
23
|
+
if (index === 0) {
|
|
24
|
+
n.text = "".concat(EM_DASH, " ").concat(n.text);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return n.mark([].concat(_toConsumableArray(n.marks), [mark]));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return n;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
var rawContentProcessor = function rawContentProcessor(raw, length) {
|
|
34
|
+
var content = parseString({
|
|
35
|
+
ignoreTokenTypes: ignoreTokenTypes,
|
|
36
|
+
schema: schema,
|
|
37
|
+
context: context,
|
|
38
|
+
input: raw
|
|
39
|
+
});
|
|
40
|
+
var decoratedContent = content.map(contentDecorator);
|
|
41
|
+
return {
|
|
42
|
+
type: 'pmnode',
|
|
43
|
+
nodes: decoratedContent,
|
|
44
|
+
length: length
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
return commonFormatter(input, position, schema, {
|
|
49
|
+
opening: '??',
|
|
50
|
+
closing: '??',
|
|
51
|
+
context: context,
|
|
52
|
+
rawContentProcessor: rawContentProcessor
|
|
53
|
+
});
|
|
54
|
+
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
|
|
3
|
+
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; } } }; }
|
|
4
|
+
|
|
5
|
+
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); }
|
|
6
|
+
|
|
7
|
+
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; }
|
|
8
|
+
|
|
9
|
+
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; }
|
|
10
|
+
|
|
11
|
+
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; }
|
|
12
|
+
|
|
13
|
+
import { commonMacro } from './common-macro';
|
|
14
|
+
import { parseAttrs } from '../utils/attrs';
|
|
15
|
+
import { title } from '../utils/title';
|
|
16
|
+
var SUPPORTED_CODEBOCK_LANGUAGES = ['abap', 'actionscript', 'ada', 'arduino', 'autoit', 'c', 'c++', 'clojure', 'coffeescript', 'csharp', 'css', 'cuda', 'd', 'dart', 'delphi', 'elixir', 'erlang', 'fortran', 'foxpro', 'go', 'groovy', 'haskell', 'haxe', 'html', 'java', 'javascript', 'json', 'julia', 'kotlin', 'latex', 'livescript', 'lua', 'mathematica', 'matlab', 'objective-c', 'objective-j', 'objectpascal', 'ocaml', 'octave', 'perl', 'php', 'powershell', 'prolog', 'puppet', 'python', 'qml', 'r', 'racket', 'restructuredtext', 'ruby', 'rust', 'sass', 'scala', 'scheme', 'shell', 'smalltalk', 'sql', 'standardml', 'swift', 'tcl', 'tex', 'typescript', 'vala', 'vbnet', 'verilog', 'vhdl', 'xml', 'xquery'];
|
|
17
|
+
export var codeMacro = function codeMacro(_ref) {
|
|
18
|
+
var input = _ref.input,
|
|
19
|
+
position = _ref.position,
|
|
20
|
+
schema = _ref.schema,
|
|
21
|
+
context = _ref.context;
|
|
22
|
+
return commonMacro(input.substring(position), schema, {
|
|
23
|
+
keyword: 'code',
|
|
24
|
+
paired: true,
|
|
25
|
+
context: context,
|
|
26
|
+
rawContentProcessor: rawContentProcessor
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
var rawContentProcessor = function rawContentProcessor(rawAttrs, rawContent, length, schema) {
|
|
31
|
+
var output = [];
|
|
32
|
+
var codeBlock = schema.nodes.codeBlock;
|
|
33
|
+
var parsedAttrs = parseAttrs(rawAttrs);
|
|
34
|
+
var trimedContent = rawContent.replace(/^\s+|\s+$/g, '');
|
|
35
|
+
var textNode = trimedContent.length ? schema.text(trimedContent) : undefined;
|
|
36
|
+
|
|
37
|
+
if (parsedAttrs.title) {
|
|
38
|
+
output.push(title(parsedAttrs.title, schema));
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
var nodeAttrs = _objectSpread(_objectSpread({}, parsedAttrs), {}, {
|
|
42
|
+
language: getCodeLanguage(parsedAttrs)
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
output.push(codeBlock.createChecked(nodeAttrs, textNode));
|
|
46
|
+
return {
|
|
47
|
+
type: 'pmnode',
|
|
48
|
+
nodes: output,
|
|
49
|
+
length: length
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
function getCodeLanguage(attrs) {
|
|
54
|
+
var keys = Object.keys(attrs).map(function (key) {
|
|
55
|
+
return key.toLowerCase();
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
var _iterator = _createForOfIteratorHelper(SUPPORTED_CODEBOCK_LANGUAGES),
|
|
59
|
+
_step;
|
|
60
|
+
|
|
61
|
+
try {
|
|
62
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
63
|
+
var language = _step.value;
|
|
64
|
+
|
|
65
|
+
if (keys.indexOf(language) !== -1) {
|
|
66
|
+
return language;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
} catch (err) {
|
|
70
|
+
_iterator.e(err);
|
|
71
|
+
} finally {
|
|
72
|
+
_iterator.f();
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (keys.indexOf('objc') !== -1) {
|
|
76
|
+
return 'objective-c';
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return 'java';
|
|
80
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
+
import { TokenType } from '.';
|
|
3
|
+
import { commonMacro } from './common-macro';
|
|
4
|
+
import { parseAttrs } from '../utils/attrs';
|
|
5
|
+
import { parseString } from '../text';
|
|
6
|
+
import { getEditorColor } from '../color';
|
|
7
|
+
import { hasAnyOfMarks } from '../utils/text';
|
|
8
|
+
export var colorMacro = function colorMacro(_ref) {
|
|
9
|
+
var input = _ref.input,
|
|
10
|
+
position = _ref.position,
|
|
11
|
+
schema = _ref.schema,
|
|
12
|
+
context = _ref.context;
|
|
13
|
+
return commonMacro(input.substring(position), schema, {
|
|
14
|
+
keyword: 'color',
|
|
15
|
+
paired: true,
|
|
16
|
+
context: context,
|
|
17
|
+
rawContentProcessor: rawContentProcessor
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
var rawContentProcessor = function rawContentProcessor(rawAttrs, rawContent, length, schema, context) {
|
|
22
|
+
var ignoreTokenTypes = [TokenType.DOUBLE_DASH_SYMBOL, TokenType.TRIPLE_DASH_SYMBOL, TokenType.QUADRUPLE_DASH_SYMBOL, TokenType.ISSUE_KEY, TokenType.TABLE];
|
|
23
|
+
var parsedAttrs = parseAttrs(rawAttrs);
|
|
24
|
+
var content = parseString({
|
|
25
|
+
ignoreTokenTypes: ignoreTokenTypes,
|
|
26
|
+
schema: schema,
|
|
27
|
+
context: context,
|
|
28
|
+
input: rawContent
|
|
29
|
+
});
|
|
30
|
+
var decoratedContent = content.map(function (n) {
|
|
31
|
+
var mark = schema.marks.textColor.create({
|
|
32
|
+
color: getEditorColor(parsedAttrs) || '#000000'
|
|
33
|
+
}); // We don't want to mix `code` mark with others
|
|
34
|
+
|
|
35
|
+
if (n.type.name === 'text' && !hasAnyOfMarks(n, ['textColor', 'code'])) {
|
|
36
|
+
return n.mark([].concat(_toConsumableArray(n.marks), [mark]));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return n;
|
|
40
|
+
});
|
|
41
|
+
return {
|
|
42
|
+
type: 'pmnode',
|
|
43
|
+
nodes: decoratedContent,
|
|
44
|
+
length: length
|
|
45
|
+
};
|
|
46
|
+
};
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import { TokenType } from './';
|
|
2
|
+
import { linkFormat } from './links/link-format';
|
|
3
|
+
import { parseNewlineOnly } from './whitespace';
|
|
4
|
+
import { parseMacroKeyword } from './keyword';
|
|
5
|
+
import { parseToken } from '.';
|
|
6
|
+
import { escapeHandler } from '../utils/escape';
|
|
7
|
+
var processState = {
|
|
8
|
+
START: 0,
|
|
9
|
+
BUFFER: 1,
|
|
10
|
+
END: 2,
|
|
11
|
+
INLINE_MACRO: 3,
|
|
12
|
+
LINK_FORMAT: 4,
|
|
13
|
+
ESCAPE: 5
|
|
14
|
+
};
|
|
15
|
+
export function commonFormatter(input, position, schema, opt) {
|
|
16
|
+
var index = position;
|
|
17
|
+
var state = processState.START;
|
|
18
|
+
var buffer = [];
|
|
19
|
+
var openingSymbolLength = opt.opening.length;
|
|
20
|
+
var closingSymbolLength = opt.closing.length;
|
|
21
|
+
|
|
22
|
+
while (index < input.length) {
|
|
23
|
+
var char = input.charAt(index);
|
|
24
|
+
var twoChar = input.substr(index, 2);
|
|
25
|
+
var charsMatchClosingSymbol = input.substr(index, closingSymbolLength);
|
|
26
|
+
|
|
27
|
+
switch (state) {
|
|
28
|
+
case processState.START:
|
|
29
|
+
{
|
|
30
|
+
if (position > 0) {
|
|
31
|
+
/**
|
|
32
|
+
* If the previous char is a alphanumeric, then it's not a valid
|
|
33
|
+
* formatter
|
|
34
|
+
*/
|
|
35
|
+
var charBeforeOpening = input.charAt(position - 1);
|
|
36
|
+
|
|
37
|
+
if (/[a-zA-Z0-9]|[^\u0000-\u007F]/.test(charBeforeOpening)) {
|
|
38
|
+
return fallback(input, index, openingSymbolLength);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
var charAfterOpening = input.charAt(index + openingSymbolLength);
|
|
43
|
+
|
|
44
|
+
if (!input.substring(position).startsWith(opt.opening) || charAfterOpening === ' ') {
|
|
45
|
+
// this is not a valid formatter mark
|
|
46
|
+
return fallback(input, position, openingSymbolLength);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
state = processState.BUFFER;
|
|
50
|
+
index += openingSymbolLength;
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
case processState.BUFFER:
|
|
55
|
+
{
|
|
56
|
+
// the linebreak would break the strong marks
|
|
57
|
+
var _length = parseNewlineOnly(input.substring(index));
|
|
58
|
+
|
|
59
|
+
if (_length) {
|
|
60
|
+
return fallback(input, position, openingSymbolLength);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (charsMatchClosingSymbol === opt.closing) {
|
|
64
|
+
state = processState.END;
|
|
65
|
+
continue;
|
|
66
|
+
} else if (twoChar === '{{') {
|
|
67
|
+
// this is a monospace
|
|
68
|
+
buffer.push(twoChar);
|
|
69
|
+
index += 2;
|
|
70
|
+
continue;
|
|
71
|
+
} else if (char === '{') {
|
|
72
|
+
state = processState.INLINE_MACRO;
|
|
73
|
+
continue;
|
|
74
|
+
} else if (char === '[') {
|
|
75
|
+
state = processState.LINK_FORMAT;
|
|
76
|
+
continue;
|
|
77
|
+
} else if (char === '\\') {
|
|
78
|
+
state = processState.ESCAPE;
|
|
79
|
+
continue;
|
|
80
|
+
} else {
|
|
81
|
+
buffer.push(char);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
case processState.END:
|
|
88
|
+
{
|
|
89
|
+
index += closingSymbolLength; // empty formatter mark is treated as normal text
|
|
90
|
+
|
|
91
|
+
if (buffer.length === 0) {
|
|
92
|
+
return fallback(input, position, openingSymbolLength);
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* If the closing symbol is followed by a alphanumeric, it's
|
|
96
|
+
* not a valid formatter, and we keep looking for
|
|
97
|
+
* next valid closing formatter
|
|
98
|
+
*/
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
if (index < input.length) {
|
|
102
|
+
var charAfterEnd = input.charAt(index);
|
|
103
|
+
|
|
104
|
+
if (/[a-zA-Z0-9]|[^\u0000-\u007F]/.test(charAfterEnd)) {
|
|
105
|
+
buffer.push(charsMatchClosingSymbol);
|
|
106
|
+
state = processState.BUFFER;
|
|
107
|
+
continue;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* If the closing symbol has an empty space before it,
|
|
112
|
+
* it's not a valid formatter
|
|
113
|
+
*/
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
if (buffer.length > 0 && buffer[buffer.length - 1].endsWith(' ')) {
|
|
117
|
+
return fallback(input, position, openingSymbolLength);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
return opt.rawContentProcessor(buffer.join(''), index - position);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
case processState.INLINE_MACRO:
|
|
124
|
+
{
|
|
125
|
+
var match = parseMacroKeyword(input.substring(index));
|
|
126
|
+
|
|
127
|
+
if (!match) {
|
|
128
|
+
buffer.push(char);
|
|
129
|
+
state = processState.BUFFER;
|
|
130
|
+
break;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Is not a problem send an empty context because we're only checking
|
|
134
|
+
* if it has a nested macro inside.
|
|
135
|
+
*/
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
var token = parseToken(input, match.type, index, schema, {});
|
|
139
|
+
|
|
140
|
+
if (token.type === 'text') {
|
|
141
|
+
buffer.push(token.text);
|
|
142
|
+
index += token.length;
|
|
143
|
+
state = processState.BUFFER;
|
|
144
|
+
continue;
|
|
145
|
+
} else if (match.type === TokenType.COLOR_MACRO) {
|
|
146
|
+
/**
|
|
147
|
+
* {color} is valid in formatter, we simply jump over the length
|
|
148
|
+
*/
|
|
149
|
+
buffer.push(input.substr(index, token.length));
|
|
150
|
+
index += token.length;
|
|
151
|
+
state = processState.BUFFER;
|
|
152
|
+
continue;
|
|
153
|
+
} else {
|
|
154
|
+
// No macro are accepted in formater
|
|
155
|
+
return fallback(input, position, openingSymbolLength);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
case processState.LINK_FORMAT:
|
|
160
|
+
{
|
|
161
|
+
/**
|
|
162
|
+
* We should "fly over" the link format and we dont want
|
|
163
|
+
* -awesome [link|https://www.atlass-ian.com] nice
|
|
164
|
+
* to be a strike through because of the '-' in link
|
|
165
|
+
*
|
|
166
|
+
* Also, is not a problem send an empty context because we're only
|
|
167
|
+
* checking if it has a nested macro inside.
|
|
168
|
+
*/
|
|
169
|
+
var _token = linkFormat({
|
|
170
|
+
input: input,
|
|
171
|
+
schema: schema,
|
|
172
|
+
position: index,
|
|
173
|
+
context: {}
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
if (_token.type === 'text') {
|
|
177
|
+
buffer.push(_token.text);
|
|
178
|
+
index += _token.length;
|
|
179
|
+
state = processState.BUFFER;
|
|
180
|
+
continue;
|
|
181
|
+
} else if (_token.type === 'pmnode') {
|
|
182
|
+
buffer.push(input.substr(index, _token.length));
|
|
183
|
+
index += _token.length;
|
|
184
|
+
state = processState.BUFFER;
|
|
185
|
+
continue;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
return fallback(input, position, openingSymbolLength);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
case processState.ESCAPE:
|
|
192
|
+
{
|
|
193
|
+
var _token2 = escapeHandler(input, index);
|
|
194
|
+
|
|
195
|
+
buffer.push(_token2.text);
|
|
196
|
+
index += _token2.length;
|
|
197
|
+
state = processState.BUFFER;
|
|
198
|
+
continue;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
default:
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
index++;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
return fallback(input, position, openingSymbolLength);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
function fallback(input, position, length) {
|
|
211
|
+
return {
|
|
212
|
+
type: 'text',
|
|
213
|
+
text: input.substr(position, length),
|
|
214
|
+
length: length
|
|
215
|
+
};
|
|
216
|
+
}
|