@incremark/core 0.2.0 → 0.2.2
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/dist/index.js +16 -382
- package/dist/index.js.map +1 -1
- package/package.json +4 -1
package/dist/index.js
CHANGED
|
@@ -1,79 +1,18 @@
|
|
|
1
1
|
import { fromMarkdown } from 'mdast-util-from-markdown';
|
|
2
2
|
import { gfmFromMarkdown } from 'mdast-util-gfm';
|
|
3
3
|
import { gfm } from 'micromark-extension-gfm';
|
|
4
|
+
import { gfmFootnoteFromMarkdown } from 'mdast-util-gfm-footnote';
|
|
4
5
|
import { codes, constants, types } from 'micromark-util-symbol';
|
|
5
|
-
import { markdownLineEndingOrSpace
|
|
6
|
+
import { markdownLineEndingOrSpace } from 'micromark-util-character';
|
|
6
7
|
import { factoryDestination } from 'micromark-factory-destination';
|
|
7
8
|
import { factoryTitle } from 'micromark-factory-title';
|
|
8
9
|
import { factoryLabel } from 'micromark-factory-label';
|
|
9
10
|
import { factoryWhitespace } from 'micromark-factory-whitespace';
|
|
11
|
+
import { gfmFootnote } from 'micromark-extension-gfm-footnote';
|
|
12
|
+
import { normalizeIdentifier } from 'micromark-util-normalize-identifier';
|
|
10
13
|
|
|
11
14
|
// src/parser/IncremarkParser.ts
|
|
12
15
|
|
|
13
|
-
// ../../node_modules/devlop/lib/default.js
|
|
14
|
-
function ok() {
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
// ../../node_modules/micromark-util-normalize-identifier/index.js
|
|
18
|
-
function normalizeIdentifier(value) {
|
|
19
|
-
return value.replace(/[\t\n\r ]+/g, " ").replace(/^ | $/g, "").toLowerCase().toUpperCase();
|
|
20
|
-
}
|
|
21
|
-
function enterFootnoteCallString() {
|
|
22
|
-
this.buffer();
|
|
23
|
-
}
|
|
24
|
-
function enterFootnoteCall(token) {
|
|
25
|
-
this.enter({ type: "footnoteReference", identifier: "", label: "" }, token);
|
|
26
|
-
}
|
|
27
|
-
function enterFootnoteDefinitionLabelString() {
|
|
28
|
-
this.buffer();
|
|
29
|
-
}
|
|
30
|
-
function enterFootnoteDefinition(token) {
|
|
31
|
-
this.enter(
|
|
32
|
-
{ type: "footnoteDefinition", identifier: "", label: "", children: [] },
|
|
33
|
-
token
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
function exitFootnoteCallString(token) {
|
|
37
|
-
const label = this.resume();
|
|
38
|
-
const node = this.stack[this.stack.length - 1];
|
|
39
|
-
ok(node.type === "footnoteReference");
|
|
40
|
-
node.identifier = normalizeIdentifier(
|
|
41
|
-
this.sliceSerialize(token)
|
|
42
|
-
).toLowerCase();
|
|
43
|
-
node.label = label;
|
|
44
|
-
}
|
|
45
|
-
function exitFootnoteCall(token) {
|
|
46
|
-
this.exit(token);
|
|
47
|
-
}
|
|
48
|
-
function exitFootnoteDefinitionLabelString(token) {
|
|
49
|
-
const label = this.resume();
|
|
50
|
-
const node = this.stack[this.stack.length - 1];
|
|
51
|
-
ok(node.type === "footnoteDefinition");
|
|
52
|
-
node.identifier = normalizeIdentifier(
|
|
53
|
-
this.sliceSerialize(token)
|
|
54
|
-
).toLowerCase();
|
|
55
|
-
node.label = label;
|
|
56
|
-
}
|
|
57
|
-
function exitFootnoteDefinition(token) {
|
|
58
|
-
this.exit(token);
|
|
59
|
-
}
|
|
60
|
-
function gfmFootnoteFromMarkdown() {
|
|
61
|
-
return {
|
|
62
|
-
enter: {
|
|
63
|
-
gfmFootnoteCallString: enterFootnoteCallString,
|
|
64
|
-
gfmFootnoteCall: enterFootnoteCall,
|
|
65
|
-
gfmFootnoteDefinitionLabelString: enterFootnoteDefinitionLabelString,
|
|
66
|
-
gfmFootnoteDefinition: enterFootnoteDefinition
|
|
67
|
-
},
|
|
68
|
-
exit: {
|
|
69
|
-
gfmFootnoteCallString: exitFootnoteCallString,
|
|
70
|
-
gfmFootnoteCall: exitFootnoteCall,
|
|
71
|
-
gfmFootnoteDefinitionLabelString: exitFootnoteDefinitionLabelString,
|
|
72
|
-
gfmFootnoteDefinition: exitFootnoteDefinition
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
|
|
77
16
|
// src/extensions/html-extension/index.ts
|
|
78
17
|
var DEFAULT_TAG_BLACKLIST = [
|
|
79
18
|
"script",
|
|
@@ -616,7 +555,7 @@ function resolveToLabelEnd(events, context) {
|
|
|
616
555
|
events.splice(open, events.length - open, ...media);
|
|
617
556
|
return events;
|
|
618
557
|
}
|
|
619
|
-
function tokenizeLabelEnd(effects,
|
|
558
|
+
function tokenizeLabelEnd(effects, ok, nok) {
|
|
620
559
|
const self = this;
|
|
621
560
|
let index = self.events.length;
|
|
622
561
|
let labelStart;
|
|
@@ -684,14 +623,14 @@ function tokenizeLabelEnd(effects, ok2, nok) {
|
|
|
684
623
|
)(code);
|
|
685
624
|
}
|
|
686
625
|
function labelEndOk(code) {
|
|
687
|
-
return
|
|
626
|
+
return ok(code);
|
|
688
627
|
}
|
|
689
628
|
function labelEndNok(code) {
|
|
690
629
|
labelStart._balanced = true;
|
|
691
630
|
return nok(code);
|
|
692
631
|
}
|
|
693
632
|
}
|
|
694
|
-
function tokenizeResource(effects,
|
|
633
|
+
function tokenizeResource(effects, ok, nok) {
|
|
695
634
|
return resourceStart;
|
|
696
635
|
function resourceStart(code) {
|
|
697
636
|
if (code !== codes.leftParenthesis) {
|
|
@@ -750,12 +689,12 @@ function tokenizeResource(effects, ok2, nok) {
|
|
|
750
689
|
effects.consume(code);
|
|
751
690
|
effects.exit(types.resourceMarker);
|
|
752
691
|
effects.exit(types.resource);
|
|
753
|
-
return
|
|
692
|
+
return ok;
|
|
754
693
|
}
|
|
755
694
|
return nok(code);
|
|
756
695
|
}
|
|
757
696
|
}
|
|
758
|
-
function tokenizeReferenceFull(effects,
|
|
697
|
+
function tokenizeReferenceFull(effects, ok, nok) {
|
|
759
698
|
const self = this;
|
|
760
699
|
return referenceFull;
|
|
761
700
|
function referenceFull(code) {
|
|
@@ -773,13 +712,13 @@ function tokenizeReferenceFull(effects, ok2, nok) {
|
|
|
773
712
|
)(code);
|
|
774
713
|
}
|
|
775
714
|
function referenceFullAfter(code) {
|
|
776
|
-
return
|
|
715
|
+
return ok(code);
|
|
777
716
|
}
|
|
778
717
|
function referenceFullMissing(code) {
|
|
779
718
|
return nok(code);
|
|
780
719
|
}
|
|
781
720
|
}
|
|
782
|
-
function tokenizeReferenceCollapsed(effects,
|
|
721
|
+
function tokenizeReferenceCollapsed(effects, ok, nok) {
|
|
783
722
|
return referenceCollapsedStart;
|
|
784
723
|
function referenceCollapsedStart(code) {
|
|
785
724
|
if (code !== codes.leftSquareBracket) {
|
|
@@ -797,316 +736,11 @@ function tokenizeReferenceCollapsed(effects, ok2, nok) {
|
|
|
797
736
|
effects.consume(code);
|
|
798
737
|
effects.exit(types.referenceMarker);
|
|
799
738
|
effects.exit(types.reference);
|
|
800
|
-
return
|
|
739
|
+
return ok;
|
|
801
740
|
}
|
|
802
741
|
return nok(code);
|
|
803
742
|
}
|
|
804
743
|
}
|
|
805
|
-
function factorySpace(effects, ok2, type, max) {
|
|
806
|
-
const limit = max ? max - 1 : Number.POSITIVE_INFINITY;
|
|
807
|
-
let size = 0;
|
|
808
|
-
return start;
|
|
809
|
-
function start(code) {
|
|
810
|
-
if (markdownSpace(code)) {
|
|
811
|
-
effects.enter(type);
|
|
812
|
-
return prefix(code);
|
|
813
|
-
}
|
|
814
|
-
return ok2(code);
|
|
815
|
-
}
|
|
816
|
-
function prefix(code) {
|
|
817
|
-
if (markdownSpace(code) && size++ < limit) {
|
|
818
|
-
effects.consume(code);
|
|
819
|
-
return prefix;
|
|
820
|
-
}
|
|
821
|
-
effects.exit(type);
|
|
822
|
-
return ok2(code);
|
|
823
|
-
}
|
|
824
|
-
}
|
|
825
|
-
var blankLine = {
|
|
826
|
-
partial: true,
|
|
827
|
-
tokenize: tokenizeBlankLine
|
|
828
|
-
};
|
|
829
|
-
function tokenizeBlankLine(effects, ok2, nok) {
|
|
830
|
-
return start;
|
|
831
|
-
function start(code) {
|
|
832
|
-
return markdownSpace(code) ? factorySpace(effects, after, "linePrefix")(code) : after(code);
|
|
833
|
-
}
|
|
834
|
-
function after(code) {
|
|
835
|
-
return code === null || markdownLineEnding(code) ? ok2(code) : nok(code);
|
|
836
|
-
}
|
|
837
|
-
}
|
|
838
|
-
var indent = {
|
|
839
|
-
tokenize: tokenizeIndent,
|
|
840
|
-
partial: true
|
|
841
|
-
};
|
|
842
|
-
function gfmFootnote() {
|
|
843
|
-
return {
|
|
844
|
-
document: {
|
|
845
|
-
[91]: {
|
|
846
|
-
name: "gfmFootnoteDefinition",
|
|
847
|
-
tokenize: tokenizeDefinitionStart,
|
|
848
|
-
continuation: {
|
|
849
|
-
tokenize: tokenizeDefinitionContinuation
|
|
850
|
-
},
|
|
851
|
-
exit: gfmFootnoteDefinitionEnd
|
|
852
|
-
}
|
|
853
|
-
},
|
|
854
|
-
text: {
|
|
855
|
-
[91]: {
|
|
856
|
-
name: "gfmFootnoteCall",
|
|
857
|
-
tokenize: tokenizeGfmFootnoteCall
|
|
858
|
-
},
|
|
859
|
-
[93]: {
|
|
860
|
-
name: "gfmPotentialFootnoteCall",
|
|
861
|
-
add: "after",
|
|
862
|
-
tokenize: tokenizePotentialGfmFootnoteCall,
|
|
863
|
-
resolveTo: resolveToPotentialGfmFootnoteCall
|
|
864
|
-
}
|
|
865
|
-
}
|
|
866
|
-
};
|
|
867
|
-
}
|
|
868
|
-
function tokenizePotentialGfmFootnoteCall(effects, ok2, nok) {
|
|
869
|
-
const self = this;
|
|
870
|
-
let index = self.events.length;
|
|
871
|
-
const defined = self.parser.gfmFootnotes || (self.parser.gfmFootnotes = []);
|
|
872
|
-
let labelStart;
|
|
873
|
-
while (index--) {
|
|
874
|
-
const token = self.events[index][1];
|
|
875
|
-
if (token.type === "labelImage") {
|
|
876
|
-
labelStart = token;
|
|
877
|
-
break;
|
|
878
|
-
}
|
|
879
|
-
if (token.type === "gfmFootnoteCall" || token.type === "labelLink" || token.type === "label" || token.type === "image" || token.type === "link") {
|
|
880
|
-
break;
|
|
881
|
-
}
|
|
882
|
-
}
|
|
883
|
-
return start;
|
|
884
|
-
function start(code) {
|
|
885
|
-
if (!labelStart || !labelStart._balanced) {
|
|
886
|
-
return nok(code);
|
|
887
|
-
}
|
|
888
|
-
const id = normalizeIdentifier(self.sliceSerialize({
|
|
889
|
-
start: labelStart.end,
|
|
890
|
-
end: self.now()
|
|
891
|
-
}));
|
|
892
|
-
if (id.codePointAt(0) !== 94 || !defined.includes(id.slice(1))) {
|
|
893
|
-
return nok(code);
|
|
894
|
-
}
|
|
895
|
-
effects.enter("gfmFootnoteCallLabelMarker");
|
|
896
|
-
effects.consume(code);
|
|
897
|
-
effects.exit("gfmFootnoteCallLabelMarker");
|
|
898
|
-
return ok2(code);
|
|
899
|
-
}
|
|
900
|
-
}
|
|
901
|
-
function resolveToPotentialGfmFootnoteCall(events, context) {
|
|
902
|
-
let index = events.length;
|
|
903
|
-
while (index--) {
|
|
904
|
-
if (events[index][1].type === "labelImage" && events[index][0] === "enter") {
|
|
905
|
-
events[index][1];
|
|
906
|
-
break;
|
|
907
|
-
}
|
|
908
|
-
}
|
|
909
|
-
events[index + 1][1].type = "data";
|
|
910
|
-
events[index + 3][1].type = "gfmFootnoteCallLabelMarker";
|
|
911
|
-
const call = {
|
|
912
|
-
type: "gfmFootnoteCall",
|
|
913
|
-
start: Object.assign({}, events[index + 3][1].start),
|
|
914
|
-
end: Object.assign({}, events[events.length - 1][1].end)
|
|
915
|
-
};
|
|
916
|
-
const marker = {
|
|
917
|
-
type: "gfmFootnoteCallMarker",
|
|
918
|
-
start: Object.assign({}, events[index + 3][1].end),
|
|
919
|
-
end: Object.assign({}, events[index + 3][1].end)
|
|
920
|
-
};
|
|
921
|
-
marker.end.column++;
|
|
922
|
-
marker.end.offset++;
|
|
923
|
-
marker.end._bufferIndex++;
|
|
924
|
-
const string = {
|
|
925
|
-
type: "gfmFootnoteCallString",
|
|
926
|
-
start: Object.assign({}, marker.end),
|
|
927
|
-
end: Object.assign({}, events[events.length - 1][1].start)
|
|
928
|
-
};
|
|
929
|
-
const chunk = {
|
|
930
|
-
type: "chunkString",
|
|
931
|
-
contentType: "string",
|
|
932
|
-
start: Object.assign({}, string.start),
|
|
933
|
-
end: Object.assign({}, string.end)
|
|
934
|
-
};
|
|
935
|
-
const replacement = [
|
|
936
|
-
// Take the `labelImageMarker` (now `data`, the `!`)
|
|
937
|
-
events[index + 1],
|
|
938
|
-
events[index + 2],
|
|
939
|
-
["enter", call, context],
|
|
940
|
-
// The `[`
|
|
941
|
-
events[index + 3],
|
|
942
|
-
events[index + 4],
|
|
943
|
-
// The `^`.
|
|
944
|
-
["enter", marker, context],
|
|
945
|
-
["exit", marker, context],
|
|
946
|
-
// Everything in between.
|
|
947
|
-
["enter", string, context],
|
|
948
|
-
["enter", chunk, context],
|
|
949
|
-
["exit", chunk, context],
|
|
950
|
-
["exit", string, context],
|
|
951
|
-
// The ending (`]`, properly parsed and labelled).
|
|
952
|
-
events[events.length - 2],
|
|
953
|
-
events[events.length - 1],
|
|
954
|
-
["exit", call, context]
|
|
955
|
-
];
|
|
956
|
-
events.splice(index, events.length - index + 1, ...replacement);
|
|
957
|
-
return events;
|
|
958
|
-
}
|
|
959
|
-
function tokenizeGfmFootnoteCall(effects, ok2, nok) {
|
|
960
|
-
const self = this;
|
|
961
|
-
const defined = self.parser.gfmFootnotes || (self.parser.gfmFootnotes = []);
|
|
962
|
-
let size = 0;
|
|
963
|
-
let data;
|
|
964
|
-
return start;
|
|
965
|
-
function start(code) {
|
|
966
|
-
effects.enter("gfmFootnoteCall");
|
|
967
|
-
effects.enter("gfmFootnoteCallLabelMarker");
|
|
968
|
-
effects.consume(code);
|
|
969
|
-
effects.exit("gfmFootnoteCallLabelMarker");
|
|
970
|
-
return callStart;
|
|
971
|
-
}
|
|
972
|
-
function callStart(code) {
|
|
973
|
-
if (code !== 94) return nok(code);
|
|
974
|
-
effects.enter("gfmFootnoteCallMarker");
|
|
975
|
-
effects.consume(code);
|
|
976
|
-
effects.exit("gfmFootnoteCallMarker");
|
|
977
|
-
effects.enter("gfmFootnoteCallString");
|
|
978
|
-
effects.enter("chunkString").contentType = "string";
|
|
979
|
-
return callData;
|
|
980
|
-
}
|
|
981
|
-
function callData(code) {
|
|
982
|
-
if (
|
|
983
|
-
// Too long.
|
|
984
|
-
size > 999 || // Closing brace with nothing.
|
|
985
|
-
code === 93 && !data || // Space or tab is not supported by GFM for some reason.
|
|
986
|
-
// `\n` and `[` not being supported makes sense.
|
|
987
|
-
code === null || code === 91 || markdownLineEndingOrSpace(code)
|
|
988
|
-
) {
|
|
989
|
-
return nok(code);
|
|
990
|
-
}
|
|
991
|
-
if (code === 93) {
|
|
992
|
-
effects.exit("chunkString");
|
|
993
|
-
const token = effects.exit("gfmFootnoteCallString");
|
|
994
|
-
if (!defined.includes(normalizeIdentifier(self.sliceSerialize(token)))) {
|
|
995
|
-
return nok(code);
|
|
996
|
-
}
|
|
997
|
-
effects.enter("gfmFootnoteCallLabelMarker");
|
|
998
|
-
effects.consume(code);
|
|
999
|
-
effects.exit("gfmFootnoteCallLabelMarker");
|
|
1000
|
-
effects.exit("gfmFootnoteCall");
|
|
1001
|
-
return ok2;
|
|
1002
|
-
}
|
|
1003
|
-
if (!markdownLineEndingOrSpace(code)) {
|
|
1004
|
-
data = true;
|
|
1005
|
-
}
|
|
1006
|
-
size++;
|
|
1007
|
-
effects.consume(code);
|
|
1008
|
-
return code === 92 ? callEscape : callData;
|
|
1009
|
-
}
|
|
1010
|
-
function callEscape(code) {
|
|
1011
|
-
if (code === 91 || code === 92 || code === 93) {
|
|
1012
|
-
effects.consume(code);
|
|
1013
|
-
size++;
|
|
1014
|
-
return callData;
|
|
1015
|
-
}
|
|
1016
|
-
return callData(code);
|
|
1017
|
-
}
|
|
1018
|
-
}
|
|
1019
|
-
function tokenizeDefinitionStart(effects, ok2, nok) {
|
|
1020
|
-
const self = this;
|
|
1021
|
-
const defined = self.parser.gfmFootnotes || (self.parser.gfmFootnotes = []);
|
|
1022
|
-
let identifier;
|
|
1023
|
-
let size = 0;
|
|
1024
|
-
let data;
|
|
1025
|
-
return start;
|
|
1026
|
-
function start(code) {
|
|
1027
|
-
effects.enter("gfmFootnoteDefinition")._container = true;
|
|
1028
|
-
effects.enter("gfmFootnoteDefinitionLabel");
|
|
1029
|
-
effects.enter("gfmFootnoteDefinitionLabelMarker");
|
|
1030
|
-
effects.consume(code);
|
|
1031
|
-
effects.exit("gfmFootnoteDefinitionLabelMarker");
|
|
1032
|
-
return labelAtMarker;
|
|
1033
|
-
}
|
|
1034
|
-
function labelAtMarker(code) {
|
|
1035
|
-
if (code === 94) {
|
|
1036
|
-
effects.enter("gfmFootnoteDefinitionMarker");
|
|
1037
|
-
effects.consume(code);
|
|
1038
|
-
effects.exit("gfmFootnoteDefinitionMarker");
|
|
1039
|
-
effects.enter("gfmFootnoteDefinitionLabelString");
|
|
1040
|
-
effects.enter("chunkString").contentType = "string";
|
|
1041
|
-
return labelInside;
|
|
1042
|
-
}
|
|
1043
|
-
return nok(code);
|
|
1044
|
-
}
|
|
1045
|
-
function labelInside(code) {
|
|
1046
|
-
if (
|
|
1047
|
-
// Too long.
|
|
1048
|
-
size > 999 || // Closing brace with nothing.
|
|
1049
|
-
code === 93 && !data || // Space or tab is not supported by GFM for some reason.
|
|
1050
|
-
// `\n` and `[` not being supported makes sense.
|
|
1051
|
-
code === null || code === 91 || markdownLineEndingOrSpace(code)
|
|
1052
|
-
) {
|
|
1053
|
-
return nok(code);
|
|
1054
|
-
}
|
|
1055
|
-
if (code === 93) {
|
|
1056
|
-
effects.exit("chunkString");
|
|
1057
|
-
const token = effects.exit("gfmFootnoteDefinitionLabelString");
|
|
1058
|
-
identifier = normalizeIdentifier(self.sliceSerialize(token));
|
|
1059
|
-
effects.enter("gfmFootnoteDefinitionLabelMarker");
|
|
1060
|
-
effects.consume(code);
|
|
1061
|
-
effects.exit("gfmFootnoteDefinitionLabelMarker");
|
|
1062
|
-
effects.exit("gfmFootnoteDefinitionLabel");
|
|
1063
|
-
return labelAfter;
|
|
1064
|
-
}
|
|
1065
|
-
if (!markdownLineEndingOrSpace(code)) {
|
|
1066
|
-
data = true;
|
|
1067
|
-
}
|
|
1068
|
-
size++;
|
|
1069
|
-
effects.consume(code);
|
|
1070
|
-
return code === 92 ? labelEscape : labelInside;
|
|
1071
|
-
}
|
|
1072
|
-
function labelEscape(code) {
|
|
1073
|
-
if (code === 91 || code === 92 || code === 93) {
|
|
1074
|
-
effects.consume(code);
|
|
1075
|
-
size++;
|
|
1076
|
-
return labelInside;
|
|
1077
|
-
}
|
|
1078
|
-
return labelInside(code);
|
|
1079
|
-
}
|
|
1080
|
-
function labelAfter(code) {
|
|
1081
|
-
if (code === 58) {
|
|
1082
|
-
effects.enter("definitionMarker");
|
|
1083
|
-
effects.consume(code);
|
|
1084
|
-
effects.exit("definitionMarker");
|
|
1085
|
-
if (!defined.includes(identifier)) {
|
|
1086
|
-
defined.push(identifier);
|
|
1087
|
-
}
|
|
1088
|
-
return factorySpace(effects, whitespaceAfter, "gfmFootnoteDefinitionWhitespace");
|
|
1089
|
-
}
|
|
1090
|
-
return nok(code);
|
|
1091
|
-
}
|
|
1092
|
-
function whitespaceAfter(code) {
|
|
1093
|
-
return ok2(code);
|
|
1094
|
-
}
|
|
1095
|
-
}
|
|
1096
|
-
function tokenizeDefinitionContinuation(effects, ok2, nok) {
|
|
1097
|
-
return effects.check(blankLine, ok2, effects.attempt(indent, ok2, nok));
|
|
1098
|
-
}
|
|
1099
|
-
function gfmFootnoteDefinitionEnd(effects) {
|
|
1100
|
-
effects.exit("gfmFootnoteDefinition");
|
|
1101
|
-
}
|
|
1102
|
-
function tokenizeIndent(effects, ok2, nok) {
|
|
1103
|
-
const self = this;
|
|
1104
|
-
return factorySpace(effects, afterPrefix, "gfmFootnoteDefinitionIndent", 4 + 1);
|
|
1105
|
-
function afterPrefix(code) {
|
|
1106
|
-
const tail = self.events[self.events.length - 1];
|
|
1107
|
-
return tail && tail[1].type === "gfmFootnoteDefinitionIndent" && tail[2].sliceSerialize(tail[1], true).length === 4 ? ok2(code) : nok(code);
|
|
1108
|
-
}
|
|
1109
|
-
}
|
|
1110
744
|
function gfmFootnoteIncremental() {
|
|
1111
745
|
const original = gfmFootnote();
|
|
1112
746
|
return {
|
|
@@ -1126,7 +760,7 @@ function gfmFootnoteIncremental() {
|
|
|
1126
760
|
}
|
|
1127
761
|
};
|
|
1128
762
|
}
|
|
1129
|
-
function tokenizeGfmFootnoteCallIncremental(effects,
|
|
763
|
+
function tokenizeGfmFootnoteCallIncremental(effects, ok, nok) {
|
|
1130
764
|
let size = 0;
|
|
1131
765
|
let data = false;
|
|
1132
766
|
return start;
|
|
@@ -1168,7 +802,7 @@ function tokenizeGfmFootnoteCallIncremental(effects, ok2, nok) {
|
|
|
1168
802
|
effects.consume(code);
|
|
1169
803
|
effects.exit("gfmFootnoteCallLabelMarker");
|
|
1170
804
|
effects.exit("gfmFootnoteCall");
|
|
1171
|
-
return
|
|
805
|
+
return ok;
|
|
1172
806
|
}
|
|
1173
807
|
if (!markdownLineEndingOrSpace(code)) {
|
|
1174
808
|
data = true;
|
|
@@ -1186,7 +820,7 @@ function tokenizeGfmFootnoteCallIncremental(effects, ok2, nok) {
|
|
|
1186
820
|
return callData(code);
|
|
1187
821
|
}
|
|
1188
822
|
}
|
|
1189
|
-
function tokenizePotentialGfmFootnoteCallIncremental(effects,
|
|
823
|
+
function tokenizePotentialGfmFootnoteCallIncremental(effects, ok, nok) {
|
|
1190
824
|
const self = this;
|
|
1191
825
|
let index = self.events.length;
|
|
1192
826
|
let labelStart;
|
|
@@ -1220,7 +854,7 @@ function tokenizePotentialGfmFootnoteCallIncremental(effects, ok2, nok) {
|
|
|
1220
854
|
effects.enter("gfmFootnoteCallLabelMarker");
|
|
1221
855
|
effects.consume(code);
|
|
1222
856
|
effects.exit("gfmFootnoteCallLabelMarker");
|
|
1223
|
-
return
|
|
857
|
+
return ok(code);
|
|
1224
858
|
}
|
|
1225
859
|
}
|
|
1226
860
|
|