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