nizel-plugin-footnotes 0.1.12 → 0.1.13
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/footnotes.iife.js +26 -22
- package/package.json +1 -1
package/dist/footnotes.iife.js
CHANGED
|
@@ -2392,7 +2392,7 @@ var NizelFootnotes = (() => {
|
|
|
2392
2392
|
var lazyContinuationCandidate = (line) => {
|
|
2393
2393
|
let candidate = line;
|
|
2394
2394
|
while (true) {
|
|
2395
|
-
const quoteMarker = /^ {0,3}> ?(
|
|
2395
|
+
const quoteMarker = /^ {0,3}> ?([^]*)$/.exec(candidate);
|
|
2396
2396
|
if (quoteMarker) {
|
|
2397
2397
|
candidate = quoteMarker[1];
|
|
2398
2398
|
continue;
|
|
@@ -3714,7 +3714,7 @@ ${line}`) !== null;
|
|
|
3714
3714
|
const quoteLines = [];
|
|
3715
3715
|
let allowLazyContinuation = false;
|
|
3716
3716
|
while (index < lines.length) {
|
|
3717
|
-
const quoteMarker = /^( {0,3}> ?)(
|
|
3717
|
+
const quoteMarker = /^( {0,3}> ?)([^]*)$/.exec(lines[index]);
|
|
3718
3718
|
if (quoteMarker) {
|
|
3719
3719
|
const markerColumn = quoteMarker[1].endsWith(" ") ? quoteMarker[1].length : quoteMarker[1].length + 1;
|
|
3720
3720
|
const quoteLine = expandLeadingTabsFromColumn(quoteMarker[2], markerColumn);
|
|
@@ -3734,11 +3734,7 @@ ${line}`) !== null;
|
|
|
3734
3734
|
if (quoteLines[quoteLines.length - 1] === "") {
|
|
3735
3735
|
quoteLines.pop();
|
|
3736
3736
|
}
|
|
3737
|
-
|
|
3738
|
-
index -= 1;
|
|
3739
|
-
} else {
|
|
3740
|
-
index += 1;
|
|
3741
|
-
}
|
|
3737
|
+
index -= 1;
|
|
3742
3738
|
children.push({
|
|
3743
3739
|
type: "blockquote",
|
|
3744
3740
|
children: parseBlocks(quoteLines, options, seenSlugs, state)
|
|
@@ -4378,7 +4374,7 @@ ${" ".repeat(marker.length + 1)}${line}`).join("")}`;
|
|
|
4378
4374
|
};
|
|
4379
4375
|
|
|
4380
4376
|
// ../nizel/dist/use-nizel.js
|
|
4381
|
-
function createNizel(options = {}, htmlBackend) {
|
|
4377
|
+
function createNizel(options = {}, htmlBackend, astBackend) {
|
|
4382
4378
|
const presetOptions = options.preset ? resolvePreset(options.preset) : {};
|
|
4383
4379
|
const effectiveOptions = { ...presetOptions, ...options, preset: void 0 };
|
|
4384
4380
|
const baseResolved = resolveOptions(effectiveOptions, {});
|
|
@@ -4412,6 +4408,9 @@ ${" ".repeat(marker.length + 1)}${line}`).join("")}`;
|
|
|
4412
4408
|
const accelerated = htmlBackend?.(source, prepared.resolved);
|
|
4413
4409
|
if (accelerated !== void 0)
|
|
4414
4410
|
return applyAfterRender(accelerated, prepared.resolved);
|
|
4411
|
+
const parsed = astBackend?.(source, prepared.resolved);
|
|
4412
|
+
if (parsed !== void 0)
|
|
4413
|
+
return renderPreparedHtml(applyAstHooks(parsed, prepared.resolved), prepared.resolved);
|
|
4415
4414
|
const { ast, resolved } = prepareMarkdown(markdown, runtimeOptions, prepared, source);
|
|
4416
4415
|
return renderPreparedHtml(ast, resolved);
|
|
4417
4416
|
};
|
|
@@ -4425,7 +4424,7 @@ ${" ".repeat(marker.length + 1)}${line}`).join("")}`;
|
|
|
4425
4424
|
nizel.meta = async (markdown, runtimeOptions) => {
|
|
4426
4425
|
return prepareMeta(markdown, runtimeOptions).meta;
|
|
4427
4426
|
};
|
|
4428
|
-
nizel.preset = (name) => createNizel(resolvePreset(name), htmlBackend);
|
|
4427
|
+
nizel.preset = (name) => createNizel(resolvePreset(name), htmlBackend, astBackend);
|
|
4429
4428
|
nizel.parse = async (markdown, runtimeOptions) => {
|
|
4430
4429
|
const resolved = resolveRuntime(runtimeOptions);
|
|
4431
4430
|
const extracted = resolved.frontmatter === false ? { markdown, frontmatter: {} } : extractFrontmatter(markdown);
|
|
@@ -4463,16 +4462,7 @@ ${" ".repeat(marker.length + 1)}${line}`).join("")}`;
|
|
|
4463
4462
|
safe: preparedMeta.resolved.safe !== false,
|
|
4464
4463
|
slugStyle: preparedMeta.resolved.slugStyle
|
|
4465
4464
|
});
|
|
4466
|
-
|
|
4467
|
-
const afterResult = plugin.hooks?.afterParse?.(ast, preparedMeta.resolved);
|
|
4468
|
-
if (afterResult)
|
|
4469
|
-
ast = afterResult;
|
|
4470
|
-
}
|
|
4471
|
-
for (const transform of preparedMeta.resolved.transforms ?? []) {
|
|
4472
|
-
const transformResult = transform(ast);
|
|
4473
|
-
if (transformResult)
|
|
4474
|
-
ast = transformResult;
|
|
4475
|
-
}
|
|
4465
|
+
ast = applyAstHooks(ast, preparedMeta.resolved);
|
|
4476
4466
|
return {
|
|
4477
4467
|
ast,
|
|
4478
4468
|
meta: preparedMeta.meta,
|
|
@@ -4519,6 +4509,20 @@ ${" ".repeat(marker.length + 1)}${line}`).join("")}`;
|
|
|
4519
4509
|
};
|
|
4520
4510
|
}
|
|
4521
4511
|
}
|
|
4512
|
+
function applyAstHooks(parsed, resolved) {
|
|
4513
|
+
let ast = parsed;
|
|
4514
|
+
for (const plugin of resolved.plugins ?? []) {
|
|
4515
|
+
const afterResult = plugin.hooks?.afterParse?.(ast, resolved);
|
|
4516
|
+
if (afterResult)
|
|
4517
|
+
ast = afterResult;
|
|
4518
|
+
}
|
|
4519
|
+
for (const transform of resolved.transforms ?? []) {
|
|
4520
|
+
const transformResult = transform(ast);
|
|
4521
|
+
if (transformResult)
|
|
4522
|
+
ast = transformResult;
|
|
4523
|
+
}
|
|
4524
|
+
return ast;
|
|
4525
|
+
}
|
|
4522
4526
|
function prepareSource(prepared) {
|
|
4523
4527
|
let markdown = prepared.markdown;
|
|
4524
4528
|
for (const plugin of prepared.resolved.plugins ?? []) {
|
|
@@ -4555,10 +4559,10 @@ ${" ".repeat(marker.length + 1)}${line}`).join("")}`;
|
|
|
4555
4559
|
function hasRuntimeOptions(runtimeOptions) {
|
|
4556
4560
|
return Boolean(runtimeOptions && Object.keys(runtimeOptions).length > 0);
|
|
4557
4561
|
}
|
|
4558
|
-
function createNizelFactory(htmlBackend) {
|
|
4559
|
-
const factory = (options) => createNizel(options, htmlBackend);
|
|
4562
|
+
function createNizelFactory(htmlBackend, astBackend) {
|
|
4563
|
+
const factory = (options) => createNizel(options, htmlBackend, astBackend);
|
|
4560
4564
|
return Object.assign(factory, {
|
|
4561
|
-
preset: (name) => createNizel(resolvePreset(name), htmlBackend)
|
|
4565
|
+
preset: (name) => createNizel(resolvePreset(name), htmlBackend, astBackend)
|
|
4562
4566
|
});
|
|
4563
4567
|
}
|
|
4564
4568
|
var useNizel = createNizelFactory();
|