mathpix-markdown-it 2.0.29 → 2.0.30

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.
Files changed (69) hide show
  1. package/es5/bundle.js +2 -2
  2. package/es5/index.js +2 -2
  3. package/lib/markdown/common/consts.d.ts +28 -0
  4. package/lib/markdown/common/consts.js +46 -2
  5. package/lib/markdown/common/consts.js.map +1 -1
  6. package/lib/markdown/md-block-rule/helper.d.ts +16 -1
  7. package/lib/markdown/md-block-rule/helper.js +93 -16
  8. package/lib/markdown/md-block-rule/helper.js.map +1 -1
  9. package/lib/markdown/md-block-rule/renewcommand.js +1 -1
  10. package/lib/markdown/md-block-rule/renewcommand.js.map +1 -1
  11. package/lib/markdown/md-inline-rule/setcounter-section.js +1 -2
  12. package/lib/markdown/md-inline-rule/setcounter-section.js.map +1 -1
  13. package/lib/markdown/md-latex-lists-env/index.d.ts +16 -0
  14. package/lib/markdown/md-latex-lists-env/index.js +55 -0
  15. package/lib/markdown/md-latex-lists-env/index.js.map +1 -0
  16. package/lib/markdown/md-latex-lists-env/latex-list-common.d.ts +31 -0
  17. package/lib/markdown/md-latex-lists-env/latex-list-common.js +78 -0
  18. package/lib/markdown/md-latex-lists-env/latex-list-common.js.map +1 -0
  19. package/lib/markdown/md-latex-lists-env/latex-list-env-block.d.ts +13 -0
  20. package/lib/markdown/md-latex-lists-env/latex-list-env-block.js +295 -0
  21. package/lib/markdown/md-latex-lists-env/latex-list-env-block.js.map +1 -0
  22. package/lib/markdown/md-latex-lists-env/latex-list-env-inline.d.ts +59 -0
  23. package/lib/markdown/md-latex-lists-env/latex-list-env-inline.js +219 -0
  24. package/lib/markdown/md-latex-lists-env/latex-list-env-inline.js.map +1 -0
  25. package/lib/markdown/md-latex-lists-env/latex-list-items.d.ts +75 -0
  26. package/lib/markdown/md-latex-lists-env/latex-list-items.js +235 -0
  27. package/lib/markdown/md-latex-lists-env/latex-list-items.js.map +1 -0
  28. package/lib/markdown/md-latex-lists-env/latex-list-tokens.d.ts +74 -0
  29. package/lib/markdown/md-latex-lists-env/latex-list-tokens.js +290 -0
  30. package/lib/markdown/md-latex-lists-env/latex-list-tokens.js.map +1 -0
  31. package/lib/markdown/md-latex-lists-env/latex-list-types.d.ts +52 -0
  32. package/lib/markdown/md-latex-lists-env/latex-list-types.js +13 -0
  33. package/lib/markdown/md-latex-lists-env/latex-list-types.js.map +1 -0
  34. package/lib/markdown/md-latex-lists-env/list-state.d.ts +48 -0
  35. package/lib/markdown/md-latex-lists-env/list-state.js +86 -0
  36. package/lib/markdown/md-latex-lists-env/list-state.js.map +1 -0
  37. package/lib/markdown/md-latex-lists-env/re-level.d.ts +62 -0
  38. package/lib/markdown/md-latex-lists-env/re-level.js +172 -0
  39. package/lib/markdown/md-latex-lists-env/re-level.js.map +1 -0
  40. package/lib/markdown/md-latex-lists-env/render-latex-list-env.d.ts +55 -0
  41. package/lib/markdown/md-latex-lists-env/render-latex-list-env.js +556 -0
  42. package/lib/markdown/md-latex-lists-env/render-latex-list-env.js.map +1 -0
  43. package/lib/markdown/md-theorem/block-rule.js +11 -1
  44. package/lib/markdown/md-theorem/block-rule.js.map +1 -1
  45. package/lib/markdown/md-theorem/inline-rule.js +1 -2
  46. package/lib/markdown/md-theorem/inline-rule.js.map +1 -1
  47. package/lib/markdown/mdPluginConfigured.d.ts +2 -1
  48. package/lib/markdown/mdPluginConfigured.js +2 -2
  49. package/lib/markdown/mdPluginConfigured.js.map +1 -1
  50. package/lib/markdown/mdPluginText.js +2 -0
  51. package/lib/markdown/mdPluginText.js.map +1 -1
  52. package/lib/styles/styles-lists.d.ts +1 -1
  53. package/lib/styles/styles-lists.js +1 -1
  54. package/lib/styles/styles-lists.js.map +1 -1
  55. package/package.json +1 -1
  56. package/lib/markdown/md-block-rule/lists/index.d.ts +0 -9
  57. package/lib/markdown/md-block-rule/lists/index.js +0 -637
  58. package/lib/markdown/md-block-rule/lists/index.js.map +0 -1
  59. package/lib/markdown/md-block-rule/lists/re-level.d.ts +0 -30
  60. package/lib/markdown/md-block-rule/lists/re-level.js +0 -162
  61. package/lib/markdown/md-block-rule/lists/re-level.js.map +0 -1
  62. package/lib/markdown/md-inline-rule/lists.d.ts +0 -5
  63. package/lib/markdown/md-inline-rule/lists.js +0 -174
  64. package/lib/markdown/md-inline-rule/lists.js.map +0 -1
  65. package/lib/markdown/md-renderer-rules/render-lists.d.ts +0 -7
  66. package/lib/markdown/md-renderer-rules/render-lists.js +0 -339
  67. package/lib/markdown/md-renderer-rules/render-lists.js.map +0 -1
  68. package/lib/markdown/mdPluginLists.js +0 -60
  69. package/lib/markdown/mdPluginLists.js.map +0 -1
@@ -0,0 +1,75 @@
1
+ import type StateInline from 'markdown-it/lib/rules_inline/state_inline';
2
+ import type StateBlock from 'markdown-it/lib/rules_block/state_block';
3
+ import type Token from 'markdown-it/lib/token';
4
+ import { ListItemsResult, ParsedListItem } from "./latex-list-types";
5
+ /**
6
+ * Processes block-style LaTeX list items by parsing their content
7
+ * using the block parser. This is used for items whose content
8
+ * contains block environments (e.g., \begin{table}, \begin{figure}, etc.).
9
+ *
10
+ * @param state - Markdown-It processing state
11
+ * @param items - Array of parsed list items
12
+ */
13
+ export declare const ListItemsBlock: (state: any, items: ParsedListItem[] | null | undefined) => void;
14
+ /**
15
+ * Processes LaTeX list items and generates Markdown-It tokens
16
+ * for both inline content and nested list structures.
17
+ *
18
+ * @param state - Markdown-It list processing state
19
+ * @param items - Parsed list items from LaTeX environment
20
+ * @param itemizeLevelTokens - Current itemize nesting level
21
+ * @param enumerateLevelTypes - Current enumerate nesting level
22
+ * @param li - Optional starting value for enumerate items
23
+ * @param iOpen - Current count of open list environments
24
+ * @param itemizeLevelContents - Itemize content depth level
25
+ *
26
+ * @returns {ListItemsResult} Updated open-list count and computed padding
27
+ */
28
+ export declare const ListItems: (state: StateBlock | StateInline, items: ParsedListItem[], itemizeLevelTokens: Token[][], enumerateLevelTypes: string[], li: {
29
+ value: number;
30
+ } | null, iOpen: number, itemizeLevelContents: string[]) => ListItemsResult;
31
+ /**
32
+ * Splits a line of LaTeX list content into logical items based on `\item`
33
+ * and appends them to the given `items` array.
34
+ *
35
+ * Special handling:
36
+ * - If `\item` appears in the middle of the line and both the prefix and
37
+ * suffix contain backticks, the whole line is treated as a continuation
38
+ * of the previous item.
39
+ * - Otherwise, text before `\item` is appended to the previous item
40
+ * (if any), and the rest is processed recursively as a new item segment.
41
+ *
42
+ * The function mutates and also returns the `items` array for convenience.
43
+ *
44
+ * @param items - Accumulator of parsed list items
45
+ * @param content - Current line content
46
+ * @param startLine - Line number where this piece starts
47
+ * @param endLine - Line number where this piece ends
48
+ * @returns The updated array of parsed list items
49
+ */
50
+ export declare const ItemsListPush: (items: ParsedListItem[], content: string, startLine: number, endLine: number) => ParsedListItem[];
51
+ /**
52
+ * Appends the given line to the previous parsed list item if it exists,
53
+ * or creates a new list item from the line if the list is empty and
54
+ * the line is not an inline list environment closing command.
55
+ *
56
+ * This is used to merge continuation lines into the last list item.
57
+ *
58
+ * @param items - Accumulated list of parsed items
59
+ * @param lineText - Current line text to append or add as a new item
60
+ * @param nextLine - Line number of the current line
61
+ * @returns The updated list of parsed items
62
+ */
63
+ export declare const ItemsAddToPrev: (items: ParsedListItem[], lineText: string, nextLine: number) => ParsedListItem[];
64
+ export declare const finalizeListItems: (state: StateBlock | StateInline, items: ParsedListItem[], itemizeLevelTokens: Token[][], enumerateLevelTypes: string[], li: {
65
+ value: number;
66
+ } | null, iOpen: number, itemizeLevelContents: string[], tokenStart: Token | null) => {
67
+ iOpen: number;
68
+ items: any[];
69
+ li: any;
70
+ };
71
+ export declare const splitInlineListEnv: (lineText: string, match: any) => {
72
+ sB: string;
73
+ sE: string;
74
+ isBacktickEscapedPair: boolean;
75
+ };
@@ -0,0 +1,235 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.splitInlineListEnv = exports.finalizeListItems = exports.ItemsAddToPrev = exports.ItemsListPush = exports.ListItems = exports.ListItemsBlock = void 0;
4
+ var tslib_1 = require("tslib");
5
+ var latex_list_tokens_1 = require("./latex-list-tokens");
6
+ var helper_1 = require("../md-block-rule/helper");
7
+ var consts_1 = require("../common/consts");
8
+ /**
9
+ * Processes block-style LaTeX list items by parsing their content
10
+ * using the block parser. This is used for items whose content
11
+ * contains block environments (e.g., \begin{table}, \begin{figure}, etc.).
12
+ *
13
+ * @param state - Markdown-It processing state
14
+ * @param items - Array of parsed list items
15
+ */
16
+ var ListItemsBlock = function (state, items) {
17
+ var e_1, _a;
18
+ var _b;
19
+ if (!items || items.length === 0) {
20
+ return;
21
+ }
22
+ try {
23
+ for (var items_1 = tslib_1.__values(items), items_1_1 = items_1.next(); !items_1_1.done; items_1_1 = items_1.next()) {
24
+ var item = items_1_1.value;
25
+ var rawContent = (_b = item === null || item === void 0 ? void 0 : item.content) !== null && _b !== void 0 ? _b : '';
26
+ var itemContent = rawContent.trim();
27
+ (0, helper_1.SetTokensBlockParse)(state, itemContent, {
28
+ startLine: item.startLine,
29
+ endLine: item.endLine + 1,
30
+ disableBlockRules: true
31
+ });
32
+ }
33
+ }
34
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
35
+ finally {
36
+ try {
37
+ if (items_1_1 && !items_1_1.done && (_a = items_1.return)) _a.call(items_1);
38
+ }
39
+ finally { if (e_1) throw e_1.error; }
40
+ }
41
+ };
42
+ exports.ListItemsBlock = ListItemsBlock;
43
+ /**
44
+ * Processes LaTeX list items and generates Markdown-It tokens
45
+ * for both inline content and nested list structures.
46
+ *
47
+ * @param state - Markdown-It list processing state
48
+ * @param items - Parsed list items from LaTeX environment
49
+ * @param itemizeLevelTokens - Current itemize nesting level
50
+ * @param enumerateLevelTypes - Current enumerate nesting level
51
+ * @param li - Optional starting value for enumerate items
52
+ * @param iOpen - Current count of open list environments
53
+ * @param itemizeLevelContents - Itemize content depth level
54
+ *
55
+ * @returns {ListItemsResult} Updated open-list count and computed padding
56
+ */
57
+ var ListItems = function (state, items, itemizeLevelTokens, enumerateLevelTypes, li, iOpen, itemizeLevelContents) {
58
+ var e_2, _a, e_3, _b;
59
+ var _c, _d;
60
+ var padding = 0;
61
+ if (!items || items.length === 0) {
62
+ return { iOpen: iOpen, padding: padding };
63
+ }
64
+ try {
65
+ for (var items_2 = tslib_1.__values(items), items_2_1 = items_2.next(); !items_2_1.done; items_2_1 = items_2.next()) {
66
+ var listItem = items_2_1.value;
67
+ state.env.parentType = state.parentType;
68
+ state.env.isBlock = true;
69
+ state.env.prentLevel = state.prentLevel;
70
+ listItem.content = listItem.content.trim();
71
+ // Detect block-level item content
72
+ if (consts_1.LATEX_BLOCK_ENV_OPEN_RE.test(listItem.content) || (listItem.content.indexOf('`') > -1)) {
73
+ var match = listItem.content.match(consts_1.LATEX_ITEM_COMMAND_RE);
74
+ if (match) {
75
+ (0, latex_list_tokens_1.setTokenListItemOpenBlock)(state, listItem.startLine, listItem.endLine + 1, match[1], li, itemizeLevelTokens, enumerateLevelTypes, itemizeLevelContents);
76
+ if (li && li.hasOwnProperty('value')) {
77
+ li = null;
78
+ }
79
+ var rawContent = (_d = (_c = listItem === null || listItem === void 0 ? void 0 : listItem.content) === null || _c === void 0 ? void 0 : _c.slice(match.index + match[0].length)) !== null && _d !== void 0 ? _d : '';
80
+ var blockContent = rawContent.trim();
81
+ (0, helper_1.SetTokensBlockParse)(state, blockContent, { disableBlockRules: true });
82
+ continue;
83
+ }
84
+ }
85
+ // Parse inline children
86
+ var inlineChildren = [];
87
+ state.md.inline.parse(listItem.content.trim(), state.md, state.env, inlineChildren);
88
+ // Context shared across child token processing
89
+ var ctx = { li: li, padding: padding, iOpen: iOpen, itemizeLevelTokens: itemizeLevelTokens, enumerateLevelTypes: enumerateLevelTypes, itemizeLevelContents: itemizeLevelContents };
90
+ try {
91
+ // Process each inline child token
92
+ for (var inlineChildren_1 = (e_3 = void 0, tslib_1.__values(inlineChildren)), inlineChildren_1_1 = inlineChildren_1.next(); !inlineChildren_1_1.done; inlineChildren_1_1 = inlineChildren_1.next()) {
93
+ var child = inlineChildren_1_1.value;
94
+ (0, latex_list_tokens_1.processListChildToken)(state, listItem, child, ctx);
95
+ }
96
+ }
97
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
98
+ finally {
99
+ try {
100
+ if (inlineChildren_1_1 && !inlineChildren_1_1.done && (_b = inlineChildren_1.return)) _b.call(inlineChildren_1);
101
+ }
102
+ finally { if (e_3) throw e_3.error; }
103
+ }
104
+ // Update context after processing children
105
+ li = ctx.li;
106
+ padding = ctx.padding;
107
+ iOpen = ctx.iOpen;
108
+ state.env.isBlock = false;
109
+ }
110
+ }
111
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
112
+ finally {
113
+ try {
114
+ if (items_2_1 && !items_2_1.done && (_a = items_2.return)) _a.call(items_2);
115
+ }
116
+ finally { if (e_2) throw e_2.error; }
117
+ }
118
+ return {
119
+ iOpen: iOpen,
120
+ padding: padding
121
+ };
122
+ };
123
+ exports.ListItems = ListItems;
124
+ /**
125
+ * Splits a line of LaTeX list content into logical items based on `\item`
126
+ * and appends them to the given `items` array.
127
+ *
128
+ * Special handling:
129
+ * - If `\item` appears in the middle of the line and both the prefix and
130
+ * suffix contain backticks, the whole line is treated as a continuation
131
+ * of the previous item.
132
+ * - Otherwise, text before `\item` is appended to the previous item
133
+ * (if any), and the rest is processed recursively as a new item segment.
134
+ *
135
+ * The function mutates and also returns the `items` array for convenience.
136
+ *
137
+ * @param items - Accumulator of parsed list items
138
+ * @param content - Current line content
139
+ * @param startLine - Line number where this piece starts
140
+ * @param endLine - Line number where this piece ends
141
+ * @returns The updated array of parsed list items
142
+ */
143
+ var ItemsListPush = function (items, content, startLine, endLine) {
144
+ var index = content.indexOf('\\item');
145
+ // No "\item" in the line or at the very start: treat whole line as one chunk
146
+ if (index <= 0) {
147
+ items.push({ content: content, startLine: startLine, endLine: endLine });
148
+ return items;
149
+ }
150
+ var before = content.slice(0, index);
151
+ var after = content.slice(index);
152
+ var hasBacktickBefore = before.includes("`");
153
+ var hasBacktickAfter = after.includes("`");
154
+ // Case 1: both parts contain backticks → treat as continuation of previous item
155
+ if (hasBacktickBefore && hasBacktickAfter) {
156
+ if (items.length > 0) {
157
+ var lastIndex = items.length - 1;
158
+ items[lastIndex].content += "\n" + content;
159
+ items[lastIndex].endLine += 1;
160
+ }
161
+ else {
162
+ items.push({ content: content, startLine: startLine, endLine: endLine });
163
+ }
164
+ return items;
165
+ }
166
+ // Case 2: normal case with "\item" in the middle
167
+ if (items.length > 0) {
168
+ // Append prefix to previous item
169
+ var lastIndex = items.length - 1;
170
+ items[lastIndex].content += "\n" + before;
171
+ items[lastIndex].endLine += 1;
172
+ }
173
+ else if (before.trim().length > 0) {
174
+ // No previous items: keep prefix as a separate item
175
+ items.push({ content: before, startLine: startLine, endLine: endLine });
176
+ }
177
+ // Recursively process the remaining part starting from "\item"
178
+ return (0, exports.ItemsListPush)(items, after, startLine, endLine);
179
+ };
180
+ exports.ItemsListPush = ItemsListPush;
181
+ /**
182
+ * Appends the given line to the previous parsed list item if it exists,
183
+ * or creates a new list item from the line if the list is empty and
184
+ * the line is not an inline list environment closing command.
185
+ *
186
+ * This is used to merge continuation lines into the last list item.
187
+ *
188
+ * @param items - Accumulated list of parsed items
189
+ * @param lineText - Current line text to append or add as a new item
190
+ * @param nextLine - Line number of the current line
191
+ * @returns The updated list of parsed items
192
+ */
193
+ var ItemsAddToPrev = function (items, lineText, nextLine) {
194
+ if (items.length > 0) {
195
+ var lastIndex = items.length - 1;
196
+ items[lastIndex].content += "\n" + lineText;
197
+ items[lastIndex].endLine = nextLine;
198
+ return items;
199
+ }
200
+ // No previous items: optionally create a new item,
201
+ // but skip pure inline end-of-list commands.
202
+ if (!consts_1.END_LIST_ENV_INLINE_RE.test(lineText)) {
203
+ (0, exports.ItemsListPush)(items, lineText, nextLine, nextLine);
204
+ }
205
+ return items;
206
+ };
207
+ exports.ItemsAddToPrev = ItemsAddToPrev;
208
+ var finalizeListItems = function (state, items, itemizeLevelTokens, enumerateLevelTypes, li, iOpen, itemizeLevelContents, tokenStart) {
209
+ var dataItems = (0, exports.ListItems)(state, items, itemizeLevelTokens, enumerateLevelTypes, li, iOpen, itemizeLevelContents);
210
+ if (tokenStart) {
211
+ var p = tokenStart;
212
+ if (!p.padding || p.padding < dataItems.padding) {
213
+ p.padding = dataItems.padding;
214
+ if (p.padding > 3) {
215
+ p.attrSet("data-padding-inline-start", String(dataItems.padding * 14));
216
+ }
217
+ }
218
+ }
219
+ return {
220
+ iOpen: dataItems.iOpen,
221
+ items: [],
222
+ li: null,
223
+ };
224
+ };
225
+ exports.finalizeListItems = finalizeListItems;
226
+ var splitInlineListEnv = function (lineText, match) {
227
+ var sB = match.index > 0 ? lineText.slice(0, match.index).trim() : "";
228
+ var sE = match.index + match[0].length < lineText.length
229
+ ? lineText.slice(match.index + match[0].length).trim()
230
+ : "";
231
+ var isBacktickEscapedPair = sB.includes("`") && sE.includes("`");
232
+ return { sB: sB, sE: sE, isBacktickEscapedPair: isBacktickEscapedPair };
233
+ };
234
+ exports.splitInlineListEnv = splitInlineListEnv;
235
+ //# sourceMappingURL=latex-list-items.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"latex-list-items.js","sourceRoot":"","sources":["../../../src/markdown/md-latex-lists-env/latex-list-items.ts"],"names":[],"mappings":";;;;AAGA,yDAG6B;AAC7B,kDAA8D;AAE9D,2CAI0B;AAE1B;;;;;;;GAOG;AACI,IAAM,cAAc,GAAG,UAC5B,KAAU,EACV,KAA0C;;;IAE1C,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;QAChC,OAAO;KACR;;QACD,KAAmB,IAAA,UAAA,iBAAA,KAAK,CAAA,4BAAA,+CAAE;YAArB,IAAM,IAAI,kBAAA;YACb,IAAM,UAAU,GAAW,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,OAAO,mCAAI,EAAE,CAAC;YAC/C,IAAM,WAAW,GAAW,UA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CAAC,EAAE,CAAC;IACjF,IAAM,EAAE,GAAW,KAAK,CAAC,KAAM,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,QAAQ,CAAC,MAAM;QACjE,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,KAAM,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE;QACvD,CAAC,CAAC,EAAE,CAAC;IACP,IAAM,qBAAqB,GAAY,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;IAC5E,OAAO,EAAE,EAAE,IAAA,EAAE,EAAE,IAAA,EAAE,qBAAqB,uBAAA,EAAE,CAAC;AAC3C,CAAC,CAAA;AAVY,QAAA,kBAAkB,sBAU9B"}
@@ -0,0 +1,74 @@
1
+ import type Token from 'markdown-it/lib/token';
2
+ import { ListType, ListInlineContext, ParsedListItem, ListOpenResult } from "./latex-list-types";
3
+ /**
4
+ * Creates an opening list-item token (<li>) for block-style LaTeX list items.
5
+ * Handles marker parsing, enumeration start values, nesting metadata,
6
+ * and updates the internal list-level state (item counters).
7
+ *
8
+ * @param state - Markdown-It state object
9
+ * @param startLine - Starting line number of the list item
10
+ * @param endLine - Ending line number of the list item
11
+ * @param marker - Optional raw \item[...] marker string
12
+ * @param li - Optional enumeration start value (e.g., \setcounter)
13
+ * @param itemizeLevelTokens - Pre-parsed bullet tokens for itemize levels
14
+ * @param enumerateLevelTypes - Current enumerate list-style types
15
+ * @param itemizeLevelContents - Raw bullet text for each itemize level
16
+ */
17
+ export declare const setTokenListItemOpenBlock: (state: any, startLine: number, endLine: number, marker: string | undefined, li: {
18
+ value: number;
19
+ } | null, itemizeLevelTokens: Token[][], enumerateLevelTypes: string[], itemizeLevelContents: string[]) => void;
20
+ /**
21
+ * Creates an opening token for LaTeX list environments (\begin{itemize}, \begin{enumerate}).
22
+ * Updates list nesting state, parent tracking, and attaches itemize/enumerate
23
+ * styling metadata used for rendering markers and list formatting.
24
+ *
25
+ * @param state - Markdown-It processing state
26
+ * @param startLine - Line number where the list begins
27
+ * @param endLine - Line number where the list ends
28
+ * @param type - List type ("itemize" or "enumerate")
29
+ * @param itemizeLevelTokens - Pre-parsed itemize bullet tokens
30
+ * @param enumerateLevelTypes - List-style types for enumerate levels
31
+ * @param itemizeLevelContents - Raw bullet text for each itemize level
32
+ */
33
+ export declare const setTokenOpenList: (state: StateBlock, startLine: number, endLine: number, type: ListType, itemizeLevelTokens: Token[][], enumerateLevelTypes: string[], itemizeLevelContents: string[]) => Token;
34
+ /**
35
+ * Parses a LaTeX list environment beginning on the current line
36
+ * (e.g., \begin{itemize} or \begin{enumerate}), opens the
37
+ * corresponding list token, and processes any inline content
38
+ * that appears on the same line after \begin{...}.
39
+ *
40
+ * Returns:
41
+ * - iOpen: how many list environments were opened
42
+ * - tokenStart: the created *_list_open token, if any
43
+ * - li: optional enumerate start value extracted via \setcounter
44
+ */
45
+ export declare const ListOpen: (state: StateBlock, startLine: number, lineText: string, itemizeLevelTokens: Token[][], enumerateLevelTypes: string[], itemizeLevelContents: string[]) => ListOpenResult;
46
+ /**
47
+ * Closes the current LaTeX list environment (\end{itemize} / \end{enumerate}).
48
+ *
49
+ * - Closes any still-open list item if needed
50
+ * - Emits the appropriate *_list_close token
51
+ * - Updates list nesting levels and internal list-level state
52
+ *
53
+ * @param state - Markdown-It processing state
54
+ * @param startLine - Line where the list block starts
55
+ * @param endLine - Line where the list block ends
56
+ * @returns The created closing list token
57
+ */
58
+ export declare const setTokenCloseList: (state: StateBlock, startLine: number, endLine: number) => void;
59
+ /**
60
+ * Processes a single inline token inside a LaTeX list item.
61
+ *
62
+ * This function:
63
+ * - Applies \setcounter values to list items (\item)
64
+ * - Handles custom list markers and computes marker padding
65
+ * - Updates parent metadata (type, nesting level, line map)
66
+ * - Adjusts list nesting state for itemize/enumerate environments
67
+ * - Attaches itemize/enumerate level styling metadata
68
+ *
69
+ * @param state - The Markdown-It state object
70
+ * @param item - Parsed list item metadata (start/end line and content)
71
+ * @param child - Inline token to process
72
+ * @param ctx - Shared context for updating list state (padding, counters, levels)
73
+ */
74
+ export declare const processListChildToken: (state: any, item: ParsedListItem, child: Token, ctx: ListInlineContext) => void;