|
4 | 4 | * @typedef {import("markdown-it/lib/parser_inline.mjs").RuleInline} RuleInline
|
5 | 5 | * @typedef {import("markdown-it/lib/rules_block/state_block.mjs").default} StateBlock
|
6 | 6 | * @typedef {import("markdown-it/lib/rules_inline/state_inline.mjs").default} StateInline
|
| 7 | + * @typedef {import("markdown-it/lib/token.mjs").default} Token |
7 | 8 | */
|
8 | 9 |
|
9 | 10 | /** @type {import("mathup").default | undefined} */
|
@@ -244,10 +245,10 @@ function defaultBlockRenderer(options = {}) {
|
244 | 245 | * @typedef {object} PluginOptions
|
245 | 246 | * @property {string} [inlineOpen]
|
246 | 247 | * @property {string} [inlineClose]
|
247 |
| - * @property {(src: string) => string} [inlineRenderer] |
| 248 | + * @property {(src: string, token: Token) => string} [inlineRenderer] |
248 | 249 | * @property {string} [blockOpen]
|
249 | 250 | * @property {string} [blockClose]
|
250 |
| - * @property {(src: string) => string} [blockRenderer] |
| 251 | + * @property {(src: string, token: Token) => string} [blockRenderer] |
251 | 252 | * @property {import("mathup").Options} [defaultRendererOptions]
|
252 | 253 | * @typedef {import("markdown-it").PluginWithOptions<PluginOptions>} Plugin
|
253 | 254 | */
|
@@ -276,8 +277,8 @@ export default function markdownItMath(
|
276 | 277 | });
|
277 | 278 |
|
278 | 279 | md.renderer.rules.math_inline = (tokens, idx) =>
|
279 |
| - inlineRenderer(tokens[idx].content); |
| 280 | + inlineRenderer(tokens[idx].content, tokens[idx]); |
280 | 281 |
|
281 | 282 | md.renderer.rules.math_block = (tokens, idx) =>
|
282 |
| - `${blockRenderer(tokens[idx].content)}\n`; |
| 283 | + `${blockRenderer(tokens[idx].content, tokens[idx])}\n`; |
283 | 284 | }
|
0 commit comments