@the_dissidents/libemmm 0.0.9 → 0.0.11
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.cjs +54 -52
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -4
- package/dist/index.d.ts +5 -4
- package/dist/index.js +54 -52
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3204,63 +3204,65 @@ var HTMLRenderState = class {
|
|
|
3204
3204
|
});
|
|
3205
3205
|
}
|
|
3206
3206
|
render(elems, cxt) {
|
|
3207
|
-
const document$1 = cxt.config.options.document;
|
|
3207
|
+
const document$1 = cxt.config.options.window.document;
|
|
3208
3208
|
(0, minimal_jsx_runtime_jsx_runtime.useDocument)(document$1);
|
|
3209
3209
|
let fragment = document$1.createDocumentFragment();
|
|
3210
3210
|
elems.flatMap((x) => cxt.renderEntity(x)).flat().forEach((x) => fragment.appendChild(x));
|
|
3211
3211
|
return fragment;
|
|
3212
3212
|
}
|
|
3213
3213
|
};
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
htmlConfig.
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
}
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
};
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
};
|
|
3261
|
-
|
|
3262
|
-
htmlConfig.
|
|
3263
|
-
|
|
3214
|
+
function createHTMLRenderConfiguration(window) {
|
|
3215
|
+
const htmlConfig = new RenderConfiguration({
|
|
3216
|
+
window,
|
|
3217
|
+
headPlugins: [],
|
|
3218
|
+
headerPlugins: [],
|
|
3219
|
+
footerPlugins: [NotesFooterPlugin],
|
|
3220
|
+
postprocessPlugins: [],
|
|
3221
|
+
transformAsset: () => void 0
|
|
3222
|
+
}, (results, cxt) => {
|
|
3223
|
+
let styles = cxt.state.stylesheet.replaceAll(/var\(--(.*?)\)/g, (m, c) => cxt.state.cssVariables.get(c) ?? m);
|
|
3224
|
+
let doc = document.implementation.createHTMLDocument(cxt.state.title);
|
|
3225
|
+
doc.head.append(/* @__PURE__ */ (0, minimal_jsx_runtime_jsx_runtime.jsx)("meta", { charset: "UTF-8" }), /* @__PURE__ */ (0, minimal_jsx_runtime_jsx_runtime.jsx)("style", { children: styles }), ...cxt.config.options.headPlugins.map((x) => x(cxt)).filter((x) => x !== void 0).flat());
|
|
3226
|
+
doc.body.append(/* @__PURE__ */ (0, minimal_jsx_runtime_jsx_runtime.jsx)("section", {
|
|
3227
|
+
class: "article-container",
|
|
3228
|
+
children: /* @__PURE__ */ (0, minimal_jsx_runtime_jsx_runtime.jsxs)("section", {
|
|
3229
|
+
class: "article-body",
|
|
3230
|
+
children: [
|
|
3231
|
+
cxt.config.options.headerPlugins.map((x) => x(cxt)).filter((x) => x !== void 0),
|
|
3232
|
+
results,
|
|
3233
|
+
cxt.config.options.footerPlugins.map((x) => x(cxt)).filter((x) => x !== void 0)
|
|
3234
|
+
]
|
|
3235
|
+
})
|
|
3236
|
+
}));
|
|
3237
|
+
for (const p of cxt.config.options.postprocessPlugins) p(cxt, doc);
|
|
3238
|
+
return doc;
|
|
3239
|
+
});
|
|
3240
|
+
htmlConfig.paragraphRenderer = (node, cxt) => /* @__PURE__ */ (0, minimal_jsx_runtime_jsx_runtime.jsx)("p", { children: node.content.flatMap((x) => cxt.renderEntity(x)) });
|
|
3241
|
+
htmlConfig.textRenderer = (node, cxt) => {
|
|
3242
|
+
switch (node.type) {
|
|
3243
|
+
case NodeType.Preformatted: return new Text(node.content.text);
|
|
3244
|
+
case NodeType.Text:
|
|
3245
|
+
case NodeType.Escaped:
|
|
3246
|
+
const split = node.content.split("\n");
|
|
3247
|
+
const result = [];
|
|
3248
|
+
for (let i = 0; i < split.length; i++) {
|
|
3249
|
+
result.push(new Text(split[i]));
|
|
3250
|
+
if (i < split.length - 1) result.push(/* @__PURE__ */ (0, minimal_jsx_runtime_jsx_runtime.jsx)("br", {}));
|
|
3251
|
+
}
|
|
3252
|
+
return result;
|
|
3253
|
+
default: return debug.never(node);
|
|
3254
|
+
}
|
|
3255
|
+
};
|
|
3256
|
+
htmlConfig.undefinedBlockRenderer = (node, cxt) => {
|
|
3257
|
+
return cxt.state.invalidBlock(node, `No renderer defined! for ${node.mod.name}`);
|
|
3258
|
+
};
|
|
3259
|
+
htmlConfig.undefinedInlineRenderer = (node, cxt) => {
|
|
3260
|
+
return cxt.state.invalidInline(node, `No renderer defined! for ${node.mod.name}`);
|
|
3261
|
+
};
|
|
3262
|
+
htmlConfig.addBlockRenderer(...HeadingBlockRenderersHTML, ...BulletBlockRenderersHTML, CodeBlockRendererHTML, ...QuoteBlockRenderersHTML, ...MiscBlockRenderersHTML, ...NoteBlockRenderersHTML, ...TableBlockRenderers, GalleryBlockRendererHTML);
|
|
3263
|
+
htmlConfig.addInlineRenderer(CodeInlineRendererHTML, ...InlineStyleRenderersHTML, ...MiscInlineRenderersHTML, ...NoteInlineRenderersHTML, ...TableInlineRenderers);
|
|
3264
|
+
return htmlConfig;
|
|
3265
|
+
}
|
|
3264
3266
|
|
|
3265
3267
|
//#endregion
|
|
3266
3268
|
//#region src/index.ts
|
|
@@ -3277,7 +3279,6 @@ exports.Configuration = Configuration;
|
|
|
3277
3279
|
exports.DebugLevel = DebugLevel;
|
|
3278
3280
|
exports.DefaultConfiguration = DefaultConfiguration;
|
|
3279
3281
|
exports.Document = Document;
|
|
3280
|
-
exports.HTMLRenderConfiguration = HTMLRenderConfiguration;
|
|
3281
3282
|
exports.HTMLRenderState = HTMLRenderState;
|
|
3282
3283
|
exports.InlineModifierDefinition = InlineModifierDefinition;
|
|
3283
3284
|
exports.MessageSeverity = MessageSeverity;
|
|
@@ -3292,6 +3293,7 @@ exports.StringSource = StringSource;
|
|
|
3292
3293
|
exports.SystemModifierDefinition = SystemModifierDefinition;
|
|
3293
3294
|
exports.cloneNode = cloneNode;
|
|
3294
3295
|
exports.cloneNodes = cloneNodes;
|
|
3296
|
+
exports.createHTMLRenderConfiguration = createHTMLRenderConfiguration;
|
|
3295
3297
|
exports.debugPrint = debugPrint;
|
|
3296
3298
|
exports.emmmVersion = emmmVersion;
|
|
3297
3299
|
Object.defineProperty(exports, 'helper', {
|