react-native-marcus 0.1.1 → 0.2.0
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/README.md +220 -63
- package/RNMarcus.podspec +6 -0
- package/android/src/main/java/app/getbullet/marcus/MarcusPackage.kt +2 -1
- package/android/src/main/java/app/getbullet/marcus/MarcusTextDecoratorView.kt +168 -0
- package/android/src/main/java/app/getbullet/marcus/MarcusTextDecoratorViewManager.kt +38 -0
- package/android/src/main/java/app/getbullet/marcus/MarcusTextDecoratorViewManagerSpec.kt +19 -0
- package/android/src/main/java/app/getbullet/marcus/MarcusTextInputDecoratorView.kt +23 -1
- package/android/src/main/java/app/getbullet/marcus/MarkdownBackgroundPainter.kt +147 -0
- package/android/src/main/java/app/getbullet/marcus/MarkdownBackgroundPass.kt +19 -0
- package/android/src/main/java/app/getbullet/marcus/MarkdownCopy.kt +87 -0
- package/android/src/main/java/app/getbullet/marcus/MarkdownFormatter.kt +652 -113
- package/android/src/main/java/app/getbullet/marcus/MarkdownRanges.kt +47 -0
- package/android/src/main/java/app/getbullet/marcus/MarkdownStyle.kt +140 -61
- package/android/src/main/java/app/getbullet/marcus/MarkdownUtils.kt +37 -7
- package/android/src/main/java/app/getbullet/marcus/spans/MarkdownAbsoluteLineHeightSpan.kt +48 -0
- package/android/src/main/java/app/getbullet/marcus/spans/MarkdownBackgroundSpan.kt +102 -48
- package/android/src/main/java/app/getbullet/marcus/spans/MarkdownBlockIndentSpan.kt +22 -4
- package/android/src/main/java/app/getbullet/marcus/spans/MarkdownBulletSpan.kt +78 -0
- package/android/src/main/java/app/getbullet/marcus/spans/MarkdownCodeBlockSpan.kt +177 -0
- package/android/src/main/java/app/getbullet/marcus/spans/MarkdownFontStyleSpan.kt +32 -0
- package/android/src/main/java/app/getbullet/marcus/spans/MarkdownFontWeightSpan.kt +34 -0
- package/android/src/main/java/app/getbullet/marcus/spans/MarkdownGapSpan.kt +24 -11
- package/android/src/main/java/app/getbullet/marcus/spans/MarkdownLetterSpacingSpan.kt +32 -0
- package/android/src/main/java/app/getbullet/marcus/spans/MarkdownTextShadowSpan.kt +32 -0
- package/android/src/main/new_arch/CMakeLists.txt +17 -0
- package/android/src/main/new_arch/RNMarcusSpec.h +1 -0
- package/android/src/main/new_arch/react/renderer/components/RNMarcusSpec/MarcusTextDecoratorShadowNode.cpp +235 -0
- package/android/src/main/new_arch/react/renderer/components/RNMarcusSpec/MarcusTextDecoratorShadowNode.h +62 -0
- package/android/src/reactNativeVersionPatch/CustomMountingManager/81/app/getbullet/marcus/CustomFabricUIManager.java +22 -3
- package/android/src/reactNativeVersionPatch/CustomMountingManager/latest/app/getbullet/marcus/CustomFabricUIManager.java +22 -3
- package/android/src/test/java/app/getbullet/marcus/MarkdownCopyTest.kt +69 -0
- package/android/src/test/java/app/getbullet/marcus/MarkdownFormatterTest.kt +170 -25
- package/android/src/test/java/app/getbullet/marcus/RenderModel.kt +22 -5
- package/android/src/test/java/app/getbullet/marcus/spans/MarkdownCodeBlockSpanTest.kt +91 -0
- package/android/src/test/resources/render-model.txt +221 -16
- package/apple/MarcusSwizzle.h +25 -0
- package/apple/MarcusTextDecoratorComponentView.h +22 -0
- package/apple/MarcusTextDecoratorComponentView.mm +72 -0
- package/apple/MarcusTextDecoratorShadowNode.h +62 -0
- package/apple/MarcusTextDecoratorShadowNode.mm +192 -0
- package/apple/MarcusTextDecoratorViewManager.h +4 -0
- package/apple/MarcusTextDecoratorViewManager.mm +11 -0
- package/apple/MarcusTextInputDecoratorComponentView.mm +1 -1
- package/apple/MarcusTextInputDecoratorShadowNode.mm +1 -1
- package/apple/MarcusTextLayoutManager.h +40 -0
- package/apple/MarcusTextLayoutManager.mm +173 -0
- package/apple/MarkdownAttributes.h +23 -2
- package/apple/MarkdownAttributes.m +6 -0
- package/apple/MarkdownCopy.swift +63 -0
- package/apple/MarkdownDecorator.swift +2 -2
- package/apple/MarkdownFormatter+React.swift +23 -0
- package/apple/MarkdownFormatter.swift +869 -148
- package/apple/MarkdownParagraphLayoutManager.swift +455 -0
- package/apple/MarkdownSwiftInterop.h +0 -1
- package/apple/MarkdownTextBackground.swift +59 -1
- package/apple/MarkdownTextFieldObserver.swift +2 -2
- package/apple/MarkdownTextLayoutFragment.swift +159 -33
- package/apple/MarkdownTextLayoutManagerDelegate.swift +67 -3
- package/apple/MarkdownTextStorageDelegate.swift +2 -2
- package/apple/MarkdownTextViewObserver.swift +2 -2
- package/apple/MarkdownUtils.swift +38 -0
- package/apple/MarkdownWritingDirection.swift +132 -0
- package/apple/RCTMarcusStyle+Codegen.h +115 -9
- package/apple/RCTMarcusStyle.h +128 -31
- package/apple/RCTMarcusStyle.m +48 -0
- package/apple/RCTParagraphComponentView+Marcus.h +17 -0
- package/apple/RCTParagraphComponentView+Marcus.mm +38 -0
- package/apple/RCTTextInputComponentView+Marcus.mm +1 -25
- package/cpp/react/renderer/components/RNMarcusSpec/MarcusTextDecoratorState.h +37 -0
- package/cpp/react/renderer/components/RNMarcusSpec/MarcusTextDecoratorViewComponentDescriptor.h +17 -0
- package/lib/commonjs/MarcusTextDecoratorViewNativeComponent.ts +199 -0
- package/lib/commonjs/MarcusTextInputDecoratorViewNativeComponent.ts +145 -58
- package/lib/commonjs/MarkdownText.js +330 -0
- package/lib/commonjs/MarkdownText.js.map +1 -0
- package/lib/commonjs/MarkdownText.web.js +529 -0
- package/lib/commonjs/MarkdownText.web.js.map +1 -0
- package/lib/commonjs/MarkdownTextInput.js +22 -27
- package/lib/commonjs/MarkdownTextInput.js.map +1 -1
- package/lib/commonjs/MarkdownTextInput.web.js +12 -7
- package/lib/commonjs/MarkdownTextInput.web.js.map +1 -1
- package/lib/commonjs/atomUtils.js +112 -0
- package/lib/commonjs/atomUtils.js.map +1 -0
- package/lib/commonjs/childrenUtils.js +36 -0
- package/lib/commonjs/childrenUtils.js.map +1 -0
- package/lib/commonjs/index.js +8 -7
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/math/environment.js +69 -0
- package/lib/commonjs/math/environment.js.map +1 -0
- package/lib/commonjs/math/index.js +61 -0
- package/lib/commonjs/math/index.js.map +1 -0
- package/lib/commonjs/math/mathjax.js +548 -0
- package/lib/commonjs/math/mathjax.js.map +1 -0
- package/lib/commonjs/metro.js +172 -0
- package/lib/commonjs/metro.js.map +1 -0
- package/lib/commonjs/parser/index.d.ts +3 -0
- package/lib/commonjs/parser/index.js +450 -42
- package/lib/commonjs/parser/index.js.map +4 -4
- package/lib/commonjs/stripUtils.js +743 -0
- package/lib/commonjs/stripUtils.js.map +1 -0
- package/lib/commonjs/styleUtils.js +194 -23
- package/lib/commonjs/styleUtils.js.map +1 -1
- package/lib/commonjs/web/MarkdownElements.css +67 -0
- package/lib/commonjs/web/MarkdownTextInput.css +9 -7
- package/lib/commonjs/web/utils/blockLayout.js +95 -7
- package/lib/commonjs/web/utils/blockLayout.js.map +1 -1
- package/lib/commonjs/web/utils/blockUtils.js +327 -54
- package/lib/commonjs/web/utils/blockUtils.js.map +1 -1
- package/lib/commonjs/web/utils/elementUtils.js +80 -0
- package/lib/commonjs/web/utils/elementUtils.js.map +1 -0
- package/lib/commonjs/web/utils/parserUtils.js +84 -28
- package/lib/commonjs/web/utils/parserUtils.js.map +1 -1
- package/lib/commonjs/web/utils/treeUtils.js +6 -0
- package/lib/commonjs/web/utils/treeUtils.js.map +1 -1
- package/lib/commonjs/web/utils/webStyleUtils.js +25 -5
- package/lib/commonjs/web/utils/webStyleUtils.js.map +1 -1
- package/lib/module/MarcusTextDecoratorViewNativeComponent.ts +199 -0
- package/lib/module/MarcusTextInputDecoratorViewNativeComponent.ts +145 -58
- package/lib/module/MarkdownText.js +325 -0
- package/lib/module/MarkdownText.js.map +1 -0
- package/lib/module/MarkdownText.web.js +524 -0
- package/lib/module/MarkdownText.web.js.map +1 -0
- package/lib/module/MarkdownTextInput.js +24 -29
- package/lib/module/MarkdownTextInput.js.map +1 -1
- package/lib/module/MarkdownTextInput.web.js +12 -7
- package/lib/module/MarkdownTextInput.web.js.map +1 -1
- package/lib/module/atomUtils.js +106 -0
- package/lib/module/atomUtils.js.map +1 -0
- package/lib/module/childrenUtils.js +33 -0
- package/lib/module/childrenUtils.js.map +1 -0
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/math/environment.js +67 -0
- package/lib/module/math/environment.js.map +1 -0
- package/lib/module/math/index.js +56 -0
- package/lib/module/math/index.js.map +1 -0
- package/lib/module/math/mathjax.js +541 -0
- package/lib/module/math/mathjax.js.map +1 -0
- package/lib/module/metro.js +169 -0
- package/lib/module/metro.js.map +1 -0
- package/lib/module/parser/index.d.ts +3 -0
- package/lib/module/parser/index.js +450 -42
- package/lib/module/parser/index.js.map +4 -4
- package/lib/module/stripUtils.js +739 -0
- package/lib/module/stripUtils.js.map +1 -0
- package/lib/module/styleUtils.js +196 -25
- package/lib/module/styleUtils.js.map +1 -1
- package/lib/module/web/MarkdownElements.css +67 -0
- package/lib/module/web/MarkdownTextInput.css +9 -7
- package/lib/module/web/utils/blockLayout.js +94 -8
- package/lib/module/web/utils/blockLayout.js.map +1 -1
- package/lib/module/web/utils/blockUtils.js +328 -56
- package/lib/module/web/utils/blockUtils.js.map +1 -1
- package/lib/module/web/utils/elementUtils.js +75 -0
- package/lib/module/web/utils/elementUtils.js.map +1 -0
- package/lib/module/web/utils/parserUtils.js +86 -30
- package/lib/module/web/utils/parserUtils.js.map +1 -1
- package/lib/module/web/utils/treeUtils.js +6 -0
- package/lib/module/web/utils/treeUtils.js.map +1 -1
- package/lib/module/web/utils/webStyleUtils.js +25 -5
- package/lib/module/web/utils/webStyleUtils.js.map +1 -1
- package/lib/typescript/commonjs/e2e/links.test.d.ts +2 -0
- package/lib/typescript/commonjs/e2e/links.test.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/MarcusTextDecoratorViewNativeComponent.d.ts +93 -0
- package/lib/typescript/commonjs/src/MarcusTextDecoratorViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/MarcusTextInputDecoratorViewNativeComponent.d.ts +64 -51
- package/lib/typescript/commonjs/src/MarcusTextInputDecoratorViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/MarkdownText.d.ts +127 -0
- package/lib/typescript/commonjs/src/MarkdownText.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/MarkdownText.web.d.ts +126 -0
- package/lib/typescript/commonjs/src/MarkdownText.web.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/MarkdownTextInput.d.ts +23 -1
- package/lib/typescript/commonjs/src/MarkdownTextInput.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/MarkdownTextInput.web.d.ts +26 -4
- package/lib/typescript/commonjs/src/MarkdownTextInput.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/atomUtils.d.ts +58 -0
- package/lib/typescript/commonjs/src/atomUtils.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/childrenUtils.d.ts +12 -0
- package/lib/typescript/commonjs/src/childrenUtils.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/commonTypes.d.ts +39 -3
- package/lib/typescript/commonjs/src/commonTypes.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/index.d.ts +2 -1
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/math/environment.d.ts +7 -0
- package/lib/typescript/commonjs/src/math/environment.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/math/index.d.ts +64 -0
- package/lib/typescript/commonjs/src/math/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/math/mathjax.d.ts +63 -0
- package/lib/typescript/commonjs/src/math/mathjax.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/metro.d.ts +59 -0
- package/lib/typescript/commonjs/src/metro.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/parser/index.d.ts +3 -3
- package/lib/typescript/commonjs/src/parser/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/parser/micromark-extension-mentions.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/rangeUtils.d.ts +1 -1
- package/lib/typescript/commonjs/src/stripUtils.d.ts +108 -0
- package/lib/typescript/commonjs/src/stripUtils.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/styleUtils.d.ts +62 -4
- package/lib/typescript/commonjs/src/styleUtils.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/web/utils/blockLayout.d.ts +32 -4
- package/lib/typescript/commonjs/src/web/utils/blockLayout.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/web/utils/blockUtils.d.ts +20 -8
- package/lib/typescript/commonjs/src/web/utils/blockUtils.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/web/utils/elementUtils.d.ts +37 -0
- package/lib/typescript/commonjs/src/web/utils/elementUtils.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/web/utils/parserUtils.d.ts +5 -5
- package/lib/typescript/commonjs/src/web/utils/parserUtils.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/web/utils/treeUtils.d.ts +6 -1
- package/lib/typescript/commonjs/src/web/utils/treeUtils.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/web/utils/webStyleUtils.d.ts +2 -2
- package/lib/typescript/commonjs/src/web/utils/webStyleUtils.d.ts.map +1 -1
- package/lib/typescript/module/e2e/links.test.d.ts +2 -0
- package/lib/typescript/module/e2e/links.test.d.ts.map +1 -0
- package/lib/typescript/module/src/MarcusTextDecoratorViewNativeComponent.d.ts +93 -0
- package/lib/typescript/module/src/MarcusTextDecoratorViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/module/src/MarcusTextInputDecoratorViewNativeComponent.d.ts +64 -51
- package/lib/typescript/module/src/MarcusTextInputDecoratorViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/module/src/MarkdownText.d.ts +127 -0
- package/lib/typescript/module/src/MarkdownText.d.ts.map +1 -0
- package/lib/typescript/module/src/MarkdownText.web.d.ts +126 -0
- package/lib/typescript/module/src/MarkdownText.web.d.ts.map +1 -0
- package/lib/typescript/module/src/MarkdownTextInput.d.ts +23 -1
- package/lib/typescript/module/src/MarkdownTextInput.d.ts.map +1 -1
- package/lib/typescript/module/src/MarkdownTextInput.web.d.ts +26 -4
- package/lib/typescript/module/src/MarkdownTextInput.web.d.ts.map +1 -1
- package/lib/typescript/module/src/atomUtils.d.ts +58 -0
- package/lib/typescript/module/src/atomUtils.d.ts.map +1 -0
- package/lib/typescript/module/src/childrenUtils.d.ts +12 -0
- package/lib/typescript/module/src/childrenUtils.d.ts.map +1 -0
- package/lib/typescript/module/src/commonTypes.d.ts +39 -3
- package/lib/typescript/module/src/commonTypes.d.ts.map +1 -1
- package/lib/typescript/module/src/index.d.ts +2 -1
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/math/environment.d.ts +7 -0
- package/lib/typescript/module/src/math/environment.d.ts.map +1 -0
- package/lib/typescript/module/src/math/index.d.ts +64 -0
- package/lib/typescript/module/src/math/index.d.ts.map +1 -0
- package/lib/typescript/module/src/math/mathjax.d.ts +63 -0
- package/lib/typescript/module/src/math/mathjax.d.ts.map +1 -0
- package/lib/typescript/module/src/metro.d.ts +59 -0
- package/lib/typescript/module/src/metro.d.ts.map +1 -0
- package/lib/typescript/module/src/parser/index.d.ts +3 -3
- package/lib/typescript/module/src/parser/index.d.ts.map +1 -1
- package/lib/typescript/module/src/parser/micromark-extension-mentions.d.ts.map +1 -1
- package/lib/typescript/module/src/rangeUtils.d.ts +1 -1
- package/lib/typescript/module/src/stripUtils.d.ts +108 -0
- package/lib/typescript/module/src/stripUtils.d.ts.map +1 -0
- package/lib/typescript/module/src/styleUtils.d.ts +62 -4
- package/lib/typescript/module/src/styleUtils.d.ts.map +1 -1
- package/lib/typescript/module/src/web/utils/blockLayout.d.ts +32 -4
- package/lib/typescript/module/src/web/utils/blockLayout.d.ts.map +1 -1
- package/lib/typescript/module/src/web/utils/blockUtils.d.ts +20 -8
- package/lib/typescript/module/src/web/utils/blockUtils.d.ts.map +1 -1
- package/lib/typescript/module/src/web/utils/elementUtils.d.ts +37 -0
- package/lib/typescript/module/src/web/utils/elementUtils.d.ts.map +1 -0
- package/lib/typescript/module/src/web/utils/parserUtils.d.ts +5 -5
- package/lib/typescript/module/src/web/utils/parserUtils.d.ts.map +1 -1
- package/lib/typescript/module/src/web/utils/treeUtils.d.ts +6 -1
- package/lib/typescript/module/src/web/utils/treeUtils.d.ts.map +1 -1
- package/lib/typescript/module/src/web/utils/webStyleUtils.d.ts +2 -2
- package/lib/typescript/module/src/web/utils/webStyleUtils.d.ts.map +1 -1
- package/package.json +29 -2
- package/react-native.config.js +8 -1
- package/src/MarcusTextDecoratorViewNativeComponent.ts +199 -0
- package/src/MarcusTextInputDecoratorViewNativeComponent.ts +145 -58
- package/src/MarkdownText.tsx +472 -0
- package/src/MarkdownText.web.tsx +668 -0
- package/src/MarkdownTextInput.tsx +42 -38
- package/src/MarkdownTextInput.web.tsx +36 -13
- package/src/atomUtils.ts +112 -0
- package/src/childrenUtils.ts +39 -0
- package/src/commonTypes.ts +69 -9
- package/src/index.tsx +2 -1
- package/src/math/environment.ts +68 -0
- package/src/math/index.ts +78 -0
- package/src/math/mathjax.ts +604 -0
- package/src/metro.ts +238 -0
- package/src/parser/index.ts +175 -10
- package/src/parser/micromark-extension-mentions.ts +104 -11
- package/src/stripUtils.ts +919 -0
- package/src/styleUtils.ts +290 -26
- package/src/web/MarkdownElements.css +67 -0
- package/src/web/MarkdownTextInput.css +9 -7
- package/src/web/utils/blockLayout.ts +124 -14
- package/src/web/utils/blockUtils.ts +365 -59
- package/src/web/utils/elementUtils.ts +87 -0
- package/src/web/utils/parserUtils.ts +119 -31
- package/src/web/utils/treeUtils.ts +6 -1
- package/src/web/utils/webStyleUtils.ts +32 -8
- package/android/src/main/java/app/getbullet/marcus/spans/MarkdownBackgroundColorSpan.kt +0 -6
- package/android/src/main/java/app/getbullet/marcus/spans/MarkdownBoldSpan.kt +0 -6
- package/android/src/main/java/app/getbullet/marcus/spans/MarkdownItalicSpan.kt +0 -6
- package/apple/RCTMarcusStyle+Codegen.mm +0 -64
- package/apple/RCTMarcusUtils.h +0 -26
- package/apple/RCTMarcusUtils.mm +0 -26
|
@@ -1,4 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
const __parsers = new Map();
|
|
2
|
+
module.exports.createParser = function createParser(options) {
|
|
3
|
+
const __marcusGfm = !!(options && options.gfm === true);
|
|
4
|
+
const __marcusMention = !!(options && options.mention === true);
|
|
5
|
+
const __marcusMath = !!(options && options.math === true);
|
|
6
|
+
const key = `${__marcusGfm}:${__marcusMention}:${__marcusMath}`;
|
|
7
|
+
const cached = __parsers.get(key);
|
|
8
|
+
if (cached !== undefined) {
|
|
9
|
+
return cached;
|
|
10
|
+
}
|
|
11
|
+
const parse = function parse(markdown) {
|
|
2
12
|
"worklet";
|
|
3
13
|
function TextDecoder() {
|
|
4
14
|
throw new Error('TextDecoder is not available in the worklet runtime');
|
|
@@ -2320,7 +2330,7 @@ var content = {
|
|
|
2320
2330
|
};
|
|
2321
2331
|
function initializeContent(effects) {
|
|
2322
2332
|
const contentStart = effects.attempt(this.parser.constructs.contentInitial, afterContentStartConstruct, paragraphInitial);
|
|
2323
|
-
let
|
|
2333
|
+
let previous4;
|
|
2324
2334
|
return contentStart;
|
|
2325
2335
|
function afterContentStartConstruct(code2) {
|
|
2326
2336
|
if (code2 === null) {
|
|
@@ -2339,12 +2349,12 @@ function initializeContent(effects) {
|
|
|
2339
2349
|
function lineStart(code2) {
|
|
2340
2350
|
const token = effects.enter("chunkText", {
|
|
2341
2351
|
contentType: "text",
|
|
2342
|
-
previous:
|
|
2352
|
+
previous: previous4
|
|
2343
2353
|
});
|
|
2344
|
-
if (
|
|
2345
|
-
|
|
2354
|
+
if (previous4) {
|
|
2355
|
+
previous4.next = token;
|
|
2346
2356
|
}
|
|
2347
|
-
|
|
2357
|
+
previous4 = token;
|
|
2348
2358
|
return data(code2);
|
|
2349
2359
|
}
|
|
2350
2360
|
function data(code2) {
|
|
@@ -2672,8 +2682,8 @@ function resolveAllAttention(events, context) {
|
|
|
2672
2682
|
}
|
|
2673
2683
|
function tokenizeAttention(effects, ok) {
|
|
2674
2684
|
const attentionMarkers2 = this.parser.constructs.attentionMarkers.null;
|
|
2675
|
-
const
|
|
2676
|
-
const before = classifyCharacter(
|
|
2685
|
+
const previous4 = this.previous;
|
|
2686
|
+
const before = classifyCharacter(previous4);
|
|
2677
2687
|
let marker;
|
|
2678
2688
|
return start;
|
|
2679
2689
|
function start(code2) {
|
|
@@ -2689,7 +2699,7 @@ function tokenizeAttention(effects, ok) {
|
|
|
2689
2699
|
const token = effects.exit("attentionSequence");
|
|
2690
2700
|
const after = classifyCharacter(code2);
|
|
2691
2701
|
const open = !after || after === 2 && before || attentionMarkers2.includes(code2);
|
|
2692
|
-
const close = !before || before === 2 && after || attentionMarkers2.includes(
|
|
2702
|
+
const close = !before || before === 2 && after || attentionMarkers2.includes(previous4);
|
|
2693
2703
|
token._open = Boolean(marker === 42 ? open : open && (before || !close));
|
|
2694
2704
|
token._close = Boolean(marker === 42 ? close : close && (after || !open));
|
|
2695
2705
|
return ok(code2);
|
|
@@ -3609,7 +3619,7 @@ function subcontent(events, eventIndex) {
|
|
|
3609
3619
|
const jumps = [];
|
|
3610
3620
|
const gaps = {};
|
|
3611
3621
|
let stream;
|
|
3612
|
-
let
|
|
3622
|
+
let previous4;
|
|
3613
3623
|
let index = -1;
|
|
3614
3624
|
let current = token;
|
|
3615
3625
|
let adjust = 0;
|
|
@@ -3624,7 +3634,7 @@ function subcontent(events, eventIndex) {
|
|
|
3624
3634
|
if (!current.next) {
|
|
3625
3635
|
stream.push(null);
|
|
3626
3636
|
}
|
|
3627
|
-
if (
|
|
3637
|
+
if (previous4) {
|
|
3628
3638
|
tokenizer.defineSkip(current.start);
|
|
3629
3639
|
}
|
|
3630
3640
|
if (current._isInFirstContentOfListItem) {
|
|
@@ -3635,7 +3645,7 @@ function subcontent(events, eventIndex) {
|
|
|
3635
3645
|
tokenizer._gfmTasklistFirstContentOfListItem = void 0;
|
|
3636
3646
|
}
|
|
3637
3647
|
}
|
|
3638
|
-
|
|
3648
|
+
previous4 = current;
|
|
3639
3649
|
current = current.next;
|
|
3640
3650
|
}
|
|
3641
3651
|
current = token;
|
|
@@ -3688,11 +3698,11 @@ function resolveContent(events) {
|
|
|
3688
3698
|
return events;
|
|
3689
3699
|
}
|
|
3690
3700
|
function tokenizeContent(effects, ok) {
|
|
3691
|
-
let
|
|
3701
|
+
let previous4;
|
|
3692
3702
|
return chunkStart;
|
|
3693
3703
|
function chunkStart(code2) {
|
|
3694
3704
|
effects.enter("content");
|
|
3695
|
-
|
|
3705
|
+
previous4 = effects.enter("chunkContent", {
|
|
3696
3706
|
contentType: "content"
|
|
3697
3707
|
});
|
|
3698
3708
|
return chunkInside(code2);
|
|
@@ -3715,11 +3725,11 @@ function tokenizeContent(effects, ok) {
|
|
|
3715
3725
|
function contentContinue(code2) {
|
|
3716
3726
|
effects.consume(code2);
|
|
3717
3727
|
effects.exit("chunkContent");
|
|
3718
|
-
|
|
3728
|
+
previous4.next = effects.enter("chunkContent", {
|
|
3719
3729
|
contentType: "content",
|
|
3720
|
-
previous:
|
|
3730
|
+
previous: previous4
|
|
3721
3731
|
});
|
|
3722
|
-
|
|
3732
|
+
previous4 = previous4.next;
|
|
3723
3733
|
return chunkInside;
|
|
3724
3734
|
}
|
|
3725
3735
|
}
|
|
@@ -6578,19 +6588,19 @@ function gfmStrikethrough(options) {
|
|
|
6578
6588
|
return events;
|
|
6579
6589
|
}
|
|
6580
6590
|
function tokenizeStrikethrough(effects, ok, nok) {
|
|
6581
|
-
const
|
|
6591
|
+
const previous4 = this.previous;
|
|
6582
6592
|
const events = this.events;
|
|
6583
6593
|
let size = 0;
|
|
6584
6594
|
return start;
|
|
6585
6595
|
function start(code2) {
|
|
6586
|
-
if (
|
|
6596
|
+
if (previous4 === 126 && events[events.length - 1][1].type !== "characterEscape") {
|
|
6587
6597
|
return nok(code2);
|
|
6588
6598
|
}
|
|
6589
6599
|
effects.enter("strikethroughSequenceTemporary");
|
|
6590
6600
|
return more(code2);
|
|
6591
6601
|
}
|
|
6592
6602
|
function more(code2) {
|
|
6593
|
-
const before = classifyCharacter(
|
|
6603
|
+
const before = classifyCharacter(previous4);
|
|
6594
6604
|
if (code2 === 126) {
|
|
6595
6605
|
if (size > 1) return nok(code2);
|
|
6596
6606
|
effects.consume(code2);
|
|
@@ -6607,14 +6617,296 @@ function gfmStrikethrough(options) {
|
|
|
6607
6617
|
}
|
|
6608
6618
|
}
|
|
6609
6619
|
|
|
6620
|
+
// node_modules/micromark-extension-math/lib/math-flow.js
|
|
6621
|
+
var mathFlow = {
|
|
6622
|
+
tokenize: tokenizeMathFenced,
|
|
6623
|
+
concrete: true,
|
|
6624
|
+
name: "mathFlow"
|
|
6625
|
+
};
|
|
6626
|
+
var nonLazyContinuation2 = {
|
|
6627
|
+
tokenize: tokenizeNonLazyContinuation2,
|
|
6628
|
+
partial: true
|
|
6629
|
+
};
|
|
6630
|
+
function tokenizeMathFenced(effects, ok, nok) {
|
|
6631
|
+
const self = this;
|
|
6632
|
+
const tail = self.events[self.events.length - 1];
|
|
6633
|
+
const initialSize = tail && tail[1].type === "linePrefix" ? tail[2].sliceSerialize(tail[1], true).length : 0;
|
|
6634
|
+
let sizeOpen = 0;
|
|
6635
|
+
return start;
|
|
6636
|
+
function start(code2) {
|
|
6637
|
+
effects.enter("mathFlow");
|
|
6638
|
+
effects.enter("mathFlowFence");
|
|
6639
|
+
effects.enter("mathFlowFenceSequence");
|
|
6640
|
+
return sequenceOpen(code2);
|
|
6641
|
+
}
|
|
6642
|
+
function sequenceOpen(code2) {
|
|
6643
|
+
if (code2 === 36) {
|
|
6644
|
+
effects.consume(code2);
|
|
6645
|
+
sizeOpen++;
|
|
6646
|
+
return sequenceOpen;
|
|
6647
|
+
}
|
|
6648
|
+
if (sizeOpen < 2) {
|
|
6649
|
+
return nok(code2);
|
|
6650
|
+
}
|
|
6651
|
+
effects.exit("mathFlowFenceSequence");
|
|
6652
|
+
return factorySpace(effects, metaBefore, "whitespace")(code2);
|
|
6653
|
+
}
|
|
6654
|
+
function metaBefore(code2) {
|
|
6655
|
+
if (code2 === null || markdownLineEnding(code2)) {
|
|
6656
|
+
return metaAfter(code2);
|
|
6657
|
+
}
|
|
6658
|
+
effects.enter("mathFlowFenceMeta");
|
|
6659
|
+
effects.enter("chunkString", {
|
|
6660
|
+
contentType: "string"
|
|
6661
|
+
});
|
|
6662
|
+
return meta(code2);
|
|
6663
|
+
}
|
|
6664
|
+
function meta(code2) {
|
|
6665
|
+
if (code2 === null || markdownLineEnding(code2)) {
|
|
6666
|
+
effects.exit("chunkString");
|
|
6667
|
+
effects.exit("mathFlowFenceMeta");
|
|
6668
|
+
return metaAfter(code2);
|
|
6669
|
+
}
|
|
6670
|
+
if (code2 === 36) {
|
|
6671
|
+
return nok(code2);
|
|
6672
|
+
}
|
|
6673
|
+
effects.consume(code2);
|
|
6674
|
+
return meta;
|
|
6675
|
+
}
|
|
6676
|
+
function metaAfter(code2) {
|
|
6677
|
+
effects.exit("mathFlowFence");
|
|
6678
|
+
if (self.interrupt) {
|
|
6679
|
+
return ok(code2);
|
|
6680
|
+
}
|
|
6681
|
+
return effects.attempt(nonLazyContinuation2, beforeNonLazyContinuation, after)(code2);
|
|
6682
|
+
}
|
|
6683
|
+
function beforeNonLazyContinuation(code2) {
|
|
6684
|
+
return effects.attempt({
|
|
6685
|
+
tokenize: tokenizeClosingFence,
|
|
6686
|
+
partial: true
|
|
6687
|
+
}, after, contentStart)(code2);
|
|
6688
|
+
}
|
|
6689
|
+
function contentStart(code2) {
|
|
6690
|
+
return (initialSize ? factorySpace(effects, beforeContentChunk, "linePrefix", initialSize + 1) : beforeContentChunk)(code2);
|
|
6691
|
+
}
|
|
6692
|
+
function beforeContentChunk(code2) {
|
|
6693
|
+
if (code2 === null) {
|
|
6694
|
+
return after(code2);
|
|
6695
|
+
}
|
|
6696
|
+
if (markdownLineEnding(code2)) {
|
|
6697
|
+
return effects.attempt(nonLazyContinuation2, beforeNonLazyContinuation, after)(code2);
|
|
6698
|
+
}
|
|
6699
|
+
effects.enter("mathFlowValue");
|
|
6700
|
+
return contentChunk(code2);
|
|
6701
|
+
}
|
|
6702
|
+
function contentChunk(code2) {
|
|
6703
|
+
if (code2 === null || markdownLineEnding(code2)) {
|
|
6704
|
+
effects.exit("mathFlowValue");
|
|
6705
|
+
return beforeContentChunk(code2);
|
|
6706
|
+
}
|
|
6707
|
+
effects.consume(code2);
|
|
6708
|
+
return contentChunk;
|
|
6709
|
+
}
|
|
6710
|
+
function after(code2) {
|
|
6711
|
+
effects.exit("mathFlow");
|
|
6712
|
+
return ok(code2);
|
|
6713
|
+
}
|
|
6714
|
+
function tokenizeClosingFence(effects2, ok2, nok2) {
|
|
6715
|
+
let size = 0;
|
|
6716
|
+
return factorySpace(effects2, beforeSequenceClose, "linePrefix", self.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4);
|
|
6717
|
+
function beforeSequenceClose(code2) {
|
|
6718
|
+
effects2.enter("mathFlowFence");
|
|
6719
|
+
effects2.enter("mathFlowFenceSequence");
|
|
6720
|
+
return sequenceClose(code2);
|
|
6721
|
+
}
|
|
6722
|
+
function sequenceClose(code2) {
|
|
6723
|
+
if (code2 === 36) {
|
|
6724
|
+
size++;
|
|
6725
|
+
effects2.consume(code2);
|
|
6726
|
+
return sequenceClose;
|
|
6727
|
+
}
|
|
6728
|
+
if (size < sizeOpen) {
|
|
6729
|
+
return nok2(code2);
|
|
6730
|
+
}
|
|
6731
|
+
effects2.exit("mathFlowFenceSequence");
|
|
6732
|
+
return factorySpace(effects2, afterSequenceClose, "whitespace")(code2);
|
|
6733
|
+
}
|
|
6734
|
+
function afterSequenceClose(code2) {
|
|
6735
|
+
if (code2 === null || markdownLineEnding(code2)) {
|
|
6736
|
+
effects2.exit("mathFlowFence");
|
|
6737
|
+
return ok2(code2);
|
|
6738
|
+
}
|
|
6739
|
+
return nok2(code2);
|
|
6740
|
+
}
|
|
6741
|
+
}
|
|
6742
|
+
}
|
|
6743
|
+
function tokenizeNonLazyContinuation2(effects, ok, nok) {
|
|
6744
|
+
const self = this;
|
|
6745
|
+
return start;
|
|
6746
|
+
function start(code2) {
|
|
6747
|
+
if (code2 === null) {
|
|
6748
|
+
return ok(code2);
|
|
6749
|
+
}
|
|
6750
|
+
effects.enter("lineEnding");
|
|
6751
|
+
effects.consume(code2);
|
|
6752
|
+
effects.exit("lineEnding");
|
|
6753
|
+
return lineStart;
|
|
6754
|
+
}
|
|
6755
|
+
function lineStart(code2) {
|
|
6756
|
+
return self.parser.lazy[self.now().line] ? nok(code2) : ok(code2);
|
|
6757
|
+
}
|
|
6758
|
+
}
|
|
6759
|
+
|
|
6760
|
+
// node_modules/micromark-extension-math/lib/math-text.js
|
|
6761
|
+
function mathText(options) {
|
|
6762
|
+
const options_ = options || {};
|
|
6763
|
+
let single = options_.singleDollarTextMath;
|
|
6764
|
+
if (single === null || single === void 0) {
|
|
6765
|
+
single = true;
|
|
6766
|
+
}
|
|
6767
|
+
return {
|
|
6768
|
+
tokenize: tokenizeMathText,
|
|
6769
|
+
resolve: resolveMathText,
|
|
6770
|
+
previous: previous2,
|
|
6771
|
+
name: "mathText"
|
|
6772
|
+
};
|
|
6773
|
+
function tokenizeMathText(effects, ok, nok) {
|
|
6774
|
+
const self = this;
|
|
6775
|
+
let sizeOpen = 0;
|
|
6776
|
+
let size;
|
|
6777
|
+
let token;
|
|
6778
|
+
return start;
|
|
6779
|
+
function start(code2) {
|
|
6780
|
+
effects.enter("mathText");
|
|
6781
|
+
effects.enter("mathTextSequence");
|
|
6782
|
+
return sequenceOpen(code2);
|
|
6783
|
+
}
|
|
6784
|
+
function sequenceOpen(code2) {
|
|
6785
|
+
if (code2 === 36) {
|
|
6786
|
+
effects.consume(code2);
|
|
6787
|
+
sizeOpen++;
|
|
6788
|
+
return sequenceOpen;
|
|
6789
|
+
}
|
|
6790
|
+
if (sizeOpen < 2 && !single) {
|
|
6791
|
+
return nok(code2);
|
|
6792
|
+
}
|
|
6793
|
+
effects.exit("mathTextSequence");
|
|
6794
|
+
return between(code2);
|
|
6795
|
+
}
|
|
6796
|
+
function between(code2) {
|
|
6797
|
+
if (code2 === null) {
|
|
6798
|
+
return nok(code2);
|
|
6799
|
+
}
|
|
6800
|
+
if (code2 === 36) {
|
|
6801
|
+
token = effects.enter("mathTextSequence");
|
|
6802
|
+
size = 0;
|
|
6803
|
+
return sequenceClose(code2);
|
|
6804
|
+
}
|
|
6805
|
+
if (code2 === 32) {
|
|
6806
|
+
effects.enter("space");
|
|
6807
|
+
effects.consume(code2);
|
|
6808
|
+
effects.exit("space");
|
|
6809
|
+
return between;
|
|
6810
|
+
}
|
|
6811
|
+
if (markdownLineEnding(code2)) {
|
|
6812
|
+
effects.enter("lineEnding");
|
|
6813
|
+
effects.consume(code2);
|
|
6814
|
+
effects.exit("lineEnding");
|
|
6815
|
+
return between;
|
|
6816
|
+
}
|
|
6817
|
+
effects.enter("mathTextData");
|
|
6818
|
+
return data(code2);
|
|
6819
|
+
}
|
|
6820
|
+
function data(code2) {
|
|
6821
|
+
if (code2 === null || code2 === 32 || code2 === 36 || markdownLineEnding(code2)) {
|
|
6822
|
+
effects.exit("mathTextData");
|
|
6823
|
+
return between(code2);
|
|
6824
|
+
}
|
|
6825
|
+
effects.consume(code2);
|
|
6826
|
+
return data;
|
|
6827
|
+
}
|
|
6828
|
+
function sequenceClose(code2) {
|
|
6829
|
+
if (code2 === 36) {
|
|
6830
|
+
effects.consume(code2);
|
|
6831
|
+
size++;
|
|
6832
|
+
return sequenceClose;
|
|
6833
|
+
}
|
|
6834
|
+
if (size === sizeOpen) {
|
|
6835
|
+
effects.exit("mathTextSequence");
|
|
6836
|
+
effects.exit("mathText");
|
|
6837
|
+
return ok(code2);
|
|
6838
|
+
}
|
|
6839
|
+
token.type = "mathTextData";
|
|
6840
|
+
return data(code2);
|
|
6841
|
+
}
|
|
6842
|
+
}
|
|
6843
|
+
}
|
|
6844
|
+
function resolveMathText(events) {
|
|
6845
|
+
let tailExitIndex = events.length - 4;
|
|
6846
|
+
let headEnterIndex = 3;
|
|
6847
|
+
let index;
|
|
6848
|
+
let enter;
|
|
6849
|
+
if ((events[headEnterIndex][1].type === "lineEnding" || events[headEnterIndex][1].type === "space") && (events[tailExitIndex][1].type === "lineEnding" || events[tailExitIndex][1].type === "space")) {
|
|
6850
|
+
index = headEnterIndex;
|
|
6851
|
+
while (++index < tailExitIndex) {
|
|
6852
|
+
if (events[index][1].type === "mathTextData") {
|
|
6853
|
+
events[tailExitIndex][1].type = "mathTextPadding";
|
|
6854
|
+
events[headEnterIndex][1].type = "mathTextPadding";
|
|
6855
|
+
headEnterIndex += 2;
|
|
6856
|
+
tailExitIndex -= 2;
|
|
6857
|
+
break;
|
|
6858
|
+
}
|
|
6859
|
+
}
|
|
6860
|
+
}
|
|
6861
|
+
index = headEnterIndex - 1;
|
|
6862
|
+
tailExitIndex++;
|
|
6863
|
+
while (++index <= tailExitIndex) {
|
|
6864
|
+
if (enter === void 0) {
|
|
6865
|
+
if (index !== tailExitIndex && events[index][1].type !== "lineEnding") {
|
|
6866
|
+
enter = index;
|
|
6867
|
+
}
|
|
6868
|
+
} else if (index === tailExitIndex || events[index][1].type === "lineEnding") {
|
|
6869
|
+
events[enter][1].type = "mathTextData";
|
|
6870
|
+
if (index !== enter + 2) {
|
|
6871
|
+
events[enter][1].end = events[index - 1][1].end;
|
|
6872
|
+
events.splice(enter + 2, index - enter - 2);
|
|
6873
|
+
tailExitIndex -= index - enter - 2;
|
|
6874
|
+
index = enter + 2;
|
|
6875
|
+
}
|
|
6876
|
+
enter = void 0;
|
|
6877
|
+
}
|
|
6878
|
+
}
|
|
6879
|
+
return events;
|
|
6880
|
+
}
|
|
6881
|
+
function previous2(code2) {
|
|
6882
|
+
return code2 !== 36 || this.events[this.events.length - 1][1].type === "characterEscape";
|
|
6883
|
+
}
|
|
6884
|
+
|
|
6885
|
+
// node_modules/micromark-extension-math/lib/syntax.js
|
|
6886
|
+
function math(options) {
|
|
6887
|
+
return {
|
|
6888
|
+
flow: {
|
|
6889
|
+
[36]: mathFlow
|
|
6890
|
+
},
|
|
6891
|
+
text: {
|
|
6892
|
+
[36]: mathText(options)
|
|
6893
|
+
}
|
|
6894
|
+
};
|
|
6895
|
+
}
|
|
6896
|
+
|
|
6610
6897
|
// src/parser/micromark-extension-mentions.ts
|
|
6611
6898
|
var LETTER = /^\p{L}$/u;
|
|
6612
|
-
var WORD = /^[\p{L}\p{M}\p{N}_]$/u;
|
|
6613
6899
|
var ALPHANUMERIC = /^[\p{L}\p{M}\p{N}]$/u;
|
|
6900
|
+
var AT = 64;
|
|
6901
|
+
var DOT = 46;
|
|
6902
|
+
var HYPHEN = 45;
|
|
6903
|
+
var UNDERSCORE = 95;
|
|
6614
6904
|
var mention = {
|
|
6615
6905
|
name: "mention",
|
|
6616
|
-
tokenize
|
|
6906
|
+
tokenize,
|
|
6907
|
+
previous: previous3
|
|
6617
6908
|
};
|
|
6909
|
+
var join = { tokenize: tokenizeJoin, partial: true };
|
|
6618
6910
|
function mentions() {
|
|
6619
6911
|
return {
|
|
6620
6912
|
text: {
|
|
@@ -6623,6 +6915,9 @@ function mentions() {
|
|
|
6623
6915
|
}
|
|
6624
6916
|
};
|
|
6625
6917
|
}
|
|
6918
|
+
function previous3(code2) {
|
|
6919
|
+
return code2 === null || code2 !== AT && !test(ALPHANUMERIC, code2);
|
|
6920
|
+
}
|
|
6626
6921
|
function tokenize(effects, ok, nok) {
|
|
6627
6922
|
return start;
|
|
6628
6923
|
function start(code2) {
|
|
@@ -6638,25 +6933,52 @@ function tokenize(effects, ok, nok) {
|
|
|
6638
6933
|
return nok(code2);
|
|
6639
6934
|
}
|
|
6640
6935
|
effects.consume(code2);
|
|
6641
|
-
return
|
|
6936
|
+
return part;
|
|
6642
6937
|
}
|
|
6643
|
-
function
|
|
6644
|
-
if (code2 !== null && test(
|
|
6938
|
+
function part(code2) {
|
|
6939
|
+
if (code2 !== null && test(ALPHANUMERIC, code2)) {
|
|
6645
6940
|
effects.consume(code2);
|
|
6646
|
-
return
|
|
6941
|
+
return part;
|
|
6647
6942
|
}
|
|
6648
|
-
if (code2 ===
|
|
6649
|
-
|
|
6943
|
+
if (code2 === DOT) {
|
|
6944
|
+
effects.consume(code2);
|
|
6945
|
+
return afterDot;
|
|
6946
|
+
}
|
|
6947
|
+
if (code2 === HYPHEN || code2 === UNDERSCORE || code2 === AT) {
|
|
6948
|
+
return effects.attempt(join, part, done);
|
|
6650
6949
|
}
|
|
6950
|
+
return done(code2);
|
|
6951
|
+
}
|
|
6952
|
+
function afterDot(code2) {
|
|
6953
|
+
if (code2 === DOT) {
|
|
6954
|
+
return done(code2);
|
|
6955
|
+
}
|
|
6956
|
+
return part(code2);
|
|
6957
|
+
}
|
|
6958
|
+
function done(code2) {
|
|
6651
6959
|
effects.exit("mention");
|
|
6652
6960
|
return ok(code2);
|
|
6653
6961
|
}
|
|
6654
|
-
|
|
6962
|
+
}
|
|
6963
|
+
function tokenizeJoin(effects, ok, nok) {
|
|
6964
|
+
return separator;
|
|
6965
|
+
function separator(code2) {
|
|
6966
|
+
effects.consume(code2);
|
|
6967
|
+
return code2 === AT ? afterAt : afterJoin;
|
|
6968
|
+
}
|
|
6969
|
+
function afterJoin(code2) {
|
|
6655
6970
|
if (code2 === null || !test(ALPHANUMERIC, code2)) {
|
|
6656
6971
|
return nok(code2);
|
|
6657
6972
|
}
|
|
6658
6973
|
effects.consume(code2);
|
|
6659
|
-
return
|
|
6974
|
+
return ok;
|
|
6975
|
+
}
|
|
6976
|
+
function afterAt(code2) {
|
|
6977
|
+
if (code2 === null || !test(LETTER, code2)) {
|
|
6978
|
+
return nok(code2);
|
|
6979
|
+
}
|
|
6980
|
+
effects.consume(code2);
|
|
6981
|
+
return ok;
|
|
6660
6982
|
}
|
|
6661
6983
|
}
|
|
6662
6984
|
function test(regex, code2) {
|
|
@@ -6669,6 +6991,8 @@ function test(regex, code2) {
|
|
|
6669
6991
|
// src/parser/index.ts
|
|
6670
6992
|
var EMOJI_TYPE = "emoji";
|
|
6671
6993
|
var SYNTAX_TYPE = "syntax";
|
|
6994
|
+
var LABEL_TYPE = "label";
|
|
6995
|
+
var ALT_TYPE = "alt";
|
|
6672
6996
|
var MAX_DEPTH = 6;
|
|
6673
6997
|
var TOKENS = {
|
|
6674
6998
|
syntax: /* @__PURE__ */ new Set([
|
|
@@ -6710,6 +7034,17 @@ var TOKENS = {
|
|
|
6710
7034
|
// Code.
|
|
6711
7035
|
"codeTextSequence",
|
|
6712
7036
|
"codeFencedFenceSequence",
|
|
7037
|
+
// Maths. The padding is the space `$ x $` is written with, which is part of
|
|
7038
|
+
// the markup rather than of the TeX.
|
|
7039
|
+
"mathTextSequence",
|
|
7040
|
+
"mathTextPadding",
|
|
7041
|
+
"mathFlowFenceSequence",
|
|
7042
|
+
// Whatever follows the opening `$$`, which nothing reads.
|
|
7043
|
+
"mathFlowFenceMeta",
|
|
7044
|
+
// Whatever follows a fenced block's language. The language itself is
|
|
7045
|
+
// `language` -- something will want to read it -- but the rest of
|
|
7046
|
+
// that line is markup like any other fence.
|
|
7047
|
+
"codeFencedFenceMeta",
|
|
6713
7048
|
// Character references.
|
|
6714
7049
|
"characterReferenceMarker",
|
|
6715
7050
|
"characterReferenceMarkerNumeric",
|
|
@@ -6726,19 +7061,39 @@ var TOKENS = {
|
|
|
6726
7061
|
special: {
|
|
6727
7062
|
codeFenced: "codeblock",
|
|
6728
7063
|
codeIndented: "codeblock",
|
|
6729
|
-
image: "
|
|
7064
|
+
image: "image",
|
|
7065
|
+
// One range over the whole span, delimiters included, the way an image is
|
|
7066
|
+
// one range over ``. What is inside is TeX: a display strips it
|
|
7067
|
+
// whole and hands it to a renderer, and an input leaves it alone. Nothing
|
|
7068
|
+
// is emitted for the content itself -- there is nothing markdown-shaped in
|
|
7069
|
+
// there to style.
|
|
7070
|
+
mathText: "math",
|
|
7071
|
+
mathFlow: "math-block"
|
|
6730
7072
|
},
|
|
6731
7073
|
scope: {
|
|
6732
|
-
|
|
6733
|
-
|
|
7074
|
+
// Identities: these carry CommonMark's own names, so what micromark calls
|
|
7075
|
+
// a token and what a range is typed as are the same word.
|
|
7076
|
+
emphasis: "emphasis",
|
|
7077
|
+
strong: "strong",
|
|
6734
7078
|
strikethrough: "strikethrough"
|
|
6735
7079
|
// Headings are absent: their level is only known once the marker token
|
|
6736
7080
|
// arrives, so they are emitted from emitHeading() instead.
|
|
6737
7081
|
},
|
|
6738
7082
|
content: {
|
|
6739
|
-
mention: "mention
|
|
7083
|
+
mention: "mention",
|
|
6740
7084
|
codeTextData: "code",
|
|
6741
|
-
codeFlowValue: "pre"
|
|
7085
|
+
codeFlowValue: "pre",
|
|
7086
|
+
// The language a fenced block declares. Its own type rather than `syntax`
|
|
7087
|
+
// because it is metadata something will want to read -- highlighting, at
|
|
7088
|
+
// least -- and no formatter styles it, so it stays plain text in an input
|
|
7089
|
+
// the way the rest of the fence line does not.
|
|
7090
|
+
codeFencedFenceInfo: "language",
|
|
7091
|
+
// The title after a destination -- `[a](b "title")`, on a link as much as on
|
|
7092
|
+
// an image. Metadata for the same reasons the language above is: a display
|
|
7093
|
+
// renderer removes it with the rest of the resource, and something that
|
|
7094
|
+
// renders an image wants to read it. Left unstyled in an input, where it is
|
|
7095
|
+
// text between two quotes.
|
|
7096
|
+
resourceTitleString: "title"
|
|
6742
7097
|
// TODO:
|
|
6743
7098
|
// htmlFlow: 'html',
|
|
6744
7099
|
// htmlText: 'html',
|
|
@@ -6775,19 +7130,31 @@ var EMOJI = {
|
|
|
6775
7130
|
"autolinkProtocol",
|
|
6776
7131
|
"autolinkEmail"
|
|
6777
7132
|
]),
|
|
6778
|
-
exclude: /* @__PURE__ */ new Set(["
|
|
7133
|
+
exclude: /* @__PURE__ */ new Set(["strong", "emphasis", "strikethrough"]),
|
|
6779
7134
|
pattern: (0, import_emoji_regex.default)()
|
|
6780
7135
|
};
|
|
6781
|
-
globalThis.__parse__micromark = function(markdown) {
|
|
7136
|
+
globalThis.__parse__micromark = function(markdown, options) {
|
|
6782
7137
|
const bomLength = markdown.charCodeAt(0) === 65279 ? 1 : 0;
|
|
6783
7138
|
if (bomLength > 0) {
|
|
6784
7139
|
markdown = markdown.slice(bomLength);
|
|
6785
7140
|
}
|
|
6786
|
-
const extensions = [
|
|
7141
|
+
const extensions = [];
|
|
7142
|
+
if (options?.gfm === true) {
|
|
7143
|
+
extensions.push(gfmAutolinkLiteral(), gfmStrikethrough());
|
|
7144
|
+
}
|
|
7145
|
+
if (options?.mention === true) {
|
|
7146
|
+
extensions.push(mentions());
|
|
7147
|
+
}
|
|
7148
|
+
if (options?.math === true) {
|
|
7149
|
+
extensions.push(math({ singleDollarTextMath: false }));
|
|
7150
|
+
}
|
|
6787
7151
|
const ranges = [];
|
|
6788
7152
|
const openBlocks = [];
|
|
6789
7153
|
const countedBlocks = [];
|
|
6790
7154
|
let pendingHeading = null;
|
|
7155
|
+
let openImages = 0;
|
|
7156
|
+
let altDepth = 0;
|
|
7157
|
+
let labelDepth = 0;
|
|
6791
7158
|
const markers = [];
|
|
6792
7159
|
const events = postprocess(
|
|
6793
7160
|
parse({ extensions }).document().write(preprocess()(markdown, "utf-8", true))
|
|
@@ -6851,6 +7218,12 @@ globalThis.__parse__micromark = function(markdown) {
|
|
|
6851
7218
|
return;
|
|
6852
7219
|
}
|
|
6853
7220
|
if (TOKENS.special[token.type]) {
|
|
7221
|
+
if (token.type === "image") {
|
|
7222
|
+
openImages++;
|
|
7223
|
+
if (altDepth > 0) {
|
|
7224
|
+
return;
|
|
7225
|
+
}
|
|
7226
|
+
}
|
|
6854
7227
|
emit(token, TOKENS.special[token.type]);
|
|
6855
7228
|
return;
|
|
6856
7229
|
}
|
|
@@ -6858,6 +7231,23 @@ globalThis.__parse__micromark = function(markdown) {
|
|
|
6858
7231
|
emit(token, SYNTAX_TYPE);
|
|
6859
7232
|
return;
|
|
6860
7233
|
}
|
|
7234
|
+
if (token.type === "labelText") {
|
|
7235
|
+
if (altDepth > 0) {
|
|
7236
|
+
altDepth++;
|
|
7237
|
+
return;
|
|
7238
|
+
}
|
|
7239
|
+
if (openImages > 0) {
|
|
7240
|
+
emit(token, ALT_TYPE);
|
|
7241
|
+
altDepth = 1;
|
|
7242
|
+
return;
|
|
7243
|
+
}
|
|
7244
|
+
emit(token, LABEL_TYPE);
|
|
7245
|
+
labelDepth++;
|
|
7246
|
+
return;
|
|
7247
|
+
}
|
|
7248
|
+
if (altDepth > 0) {
|
|
7249
|
+
return;
|
|
7250
|
+
}
|
|
6861
7251
|
if (TOKENS.scope[token.type]) {
|
|
6862
7252
|
emit(token, TOKENS.scope[token.type]);
|
|
6863
7253
|
return;
|
|
@@ -6871,11 +7261,26 @@ globalThis.__parse__micromark = function(markdown) {
|
|
|
6871
7261
|
return;
|
|
6872
7262
|
}
|
|
6873
7263
|
if (TOKENS.link[token.type]) {
|
|
7264
|
+
if (labelDepth > 0 && openImages === 0) {
|
|
7265
|
+
return;
|
|
7266
|
+
}
|
|
6874
7267
|
emit(token, TOKENS.link[token.type]);
|
|
6875
7268
|
return;
|
|
6876
7269
|
}
|
|
6877
7270
|
}
|
|
6878
7271
|
function exit2(token) {
|
|
7272
|
+
if (token.type === "labelText") {
|
|
7273
|
+
if (altDepth > 0) {
|
|
7274
|
+
altDepth--;
|
|
7275
|
+
} else if (labelDepth > 0) {
|
|
7276
|
+
labelDepth--;
|
|
7277
|
+
}
|
|
7278
|
+
return;
|
|
7279
|
+
}
|
|
7280
|
+
if (token.type === "image") {
|
|
7281
|
+
openImages--;
|
|
7282
|
+
return;
|
|
7283
|
+
}
|
|
6879
7284
|
if (!TOKENS.block[token.type]) {
|
|
6880
7285
|
return;
|
|
6881
7286
|
}
|
|
@@ -6964,7 +7369,7 @@ globalThis.__parse__micromark = function(markdown) {
|
|
|
6964
7369
|
}
|
|
6965
7370
|
function push2(start, end, type, depth) {
|
|
6966
7371
|
if (start >= end) return;
|
|
6967
|
-
const
|
|
7372
|
+
const previous4 = ranges[ranges.length - 1];
|
|
6968
7373
|
if (depth === void 0 && // Two containers opening on one line put their prefixes back to back.
|
|
6969
7374
|
// Merging them would lose which prefix belongs to which container.
|
|
6970
7375
|
type !== BLOCK_PREFIX && // Adjacent syntax belongs to whatever encloses it, and neighbors often sit in different
|
|
@@ -6973,8 +7378,8 @@ globalThis.__parse__micromark = function(markdown) {
|
|
|
6973
7378
|
// the first one's container -- overlapping it without containing it or being contained by
|
|
6974
7379
|
// it, which is not a tree and renders the shared characters once per range. Runs that do
|
|
6975
7380
|
// share an enclosure, like `>>`, cost only an extra span.
|
|
6976
|
-
type !== SYNTAX_TYPE &&
|
|
6977
|
-
|
|
7381
|
+
type !== SYNTAX_TYPE && previous4 && previous4.type === type && previous4.start + previous4.length === start) {
|
|
7382
|
+
previous4.length = end - previous4.start;
|
|
6978
7383
|
return;
|
|
6979
7384
|
}
|
|
6980
7385
|
const range = {
|
|
@@ -7025,6 +7430,9 @@ globalThis.__parse__micromark = function(markdown) {
|
|
|
7025
7430
|
ranges.push(...result);
|
|
7026
7431
|
}
|
|
7027
7432
|
};
|
|
7028
|
-
return globalThis.__parse__micromark(markdown);
|
|
7433
|
+
return globalThis.__parse__micromark(markdown, { gfm: __marcusGfm, mention: __marcusMention, math: __marcusMath });
|
|
7434
|
+
};
|
|
7435
|
+
__parsers.set(key, parse);
|
|
7436
|
+
return parse;
|
|
7029
7437
|
}
|
|
7030
7438
|
//# sourceMappingURL=index.js.map
|