@haklex/rich-litexml 0.9.3 → 0.10.0
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/cli.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { i as createDefaultRegistry, t as deserializeFromXml } from "./deserializer-
|
|
2
|
+
import { i as createDefaultRegistry, t as deserializeFromXml } from "./deserializer-C8mfRcEX.js";
|
|
3
3
|
import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
//#region src/cli.ts
|
|
@@ -148,7 +148,10 @@ function extractCdataText(el) {
|
|
|
148
148
|
const val = child.nodeValue ?? "";
|
|
149
149
|
if (val.startsWith("[CDATA[") && val.endsWith("]]")) return val.slice(7, -2);
|
|
150
150
|
}
|
|
151
|
-
return
|
|
151
|
+
return null;
|
|
152
|
+
}
|
|
153
|
+
function extractRawText(el) {
|
|
154
|
+
return extractCdataText(el) ?? el.textContent ?? "";
|
|
152
155
|
}
|
|
153
156
|
function registerCustomReaders(registry) {
|
|
154
157
|
registry.registerReader("img", (el) => {
|
|
@@ -196,27 +199,27 @@ function registerCustomReaders(registry) {
|
|
|
196
199
|
registry.registerReader("codeblock", (el) => ({
|
|
197
200
|
type: "code-block",
|
|
198
201
|
...extractBlockId(el),
|
|
199
|
-
code: el
|
|
202
|
+
code: extractRawText(el),
|
|
200
203
|
language: el.getAttribute("lang") ?? "",
|
|
201
204
|
version: 1
|
|
202
205
|
}));
|
|
203
206
|
registry.registerReader("mermaid", (el) => ({
|
|
204
207
|
type: "mermaid",
|
|
205
208
|
...extractBlockId(el),
|
|
206
|
-
diagram: el
|
|
209
|
+
diagram: extractRawText(el),
|
|
207
210
|
version: 1
|
|
208
211
|
}));
|
|
209
212
|
registry.registerReader("math", (el) => {
|
|
210
213
|
if (el.getAttribute("display") === "block") return {
|
|
211
214
|
type: "katex-block",
|
|
212
215
|
...extractBlockId(el),
|
|
213
|
-
equation: el
|
|
216
|
+
equation: extractRawText(el),
|
|
214
217
|
version: 1
|
|
215
218
|
};
|
|
216
219
|
const color = el.getAttribute("color");
|
|
217
220
|
return {
|
|
218
221
|
type: "katex-inline",
|
|
219
|
-
equation: el
|
|
222
|
+
equation: extractRawText(el),
|
|
220
223
|
...color ? { color } : {},
|
|
221
224
|
version: 1
|
|
222
225
|
};
|
|
@@ -399,7 +402,7 @@ function registerCustomReaders(registry) {
|
|
|
399
402
|
const files = [];
|
|
400
403
|
for (const child of el.children) if (child.tagName.toLowerCase() === "file") files.push({
|
|
401
404
|
filename: child.getAttribute("name") ?? "",
|
|
402
|
-
code: child
|
|
405
|
+
code: extractRawText(child),
|
|
403
406
|
language: child.getAttribute("lang") ?? ""
|
|
404
407
|
});
|
|
405
408
|
return {
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as registerCustomWriters, c as registerCustomReaders, i as createDefaultRegistry, l as registerBuiltinReaders, n as deserializeNodesFromXml, o as registerBuiltinWriters, r as wrapWithFormatTags, s as LitexmlRegistry, t as deserializeFromXml } from "./deserializer-
|
|
1
|
+
import { a as registerCustomWriters, c as registerCustomReaders, i as createDefaultRegistry, l as registerBuiltinReaders, n as deserializeNodesFromXml, o as registerBuiltinWriters, r as wrapWithFormatTags, s as LitexmlRegistry, t as deserializeFromXml } from "./deserializer-C8mfRcEX.js";
|
|
2
2
|
//#region src/xml-utils.ts
|
|
3
3
|
var ESCAPE_MAP = {
|
|
4
4
|
"&": "&",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"custom.d.ts","sourceRoot":"","sources":["../../src/readers/custom.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"custom.d.ts","sourceRoot":"","sources":["../../src/readers/custom.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAuCnD,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,eAAe,GAAG,IAAI,CA2crE"}
|