@hyperbook/markdown 0.42.0 → 0.42.1
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/helper.d.ts +1 -1
- package/dist/index.js +15 -11
- package/dist/index.js.map +2 -2
- package/package.json +1 -1
package/dist/helper.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { HyperbookContext } from "@hyperbook/types";
|
|
2
|
-
export declare const readFile: (src: string, ctx: HyperbookContext) => string;
|
|
2
|
+
export declare const readFile: (src: string, ctx: HyperbookContext) => string | null;
|
package/dist/index.js
CHANGED
|
@@ -70960,15 +70960,19 @@ var readFile = (src, ctx) => {
|
|
|
70960
70960
|
try {
|
|
70961
70961
|
srcFile = fs2.readFileSync(path4.join(ctx.root, "book", src), "utf-8");
|
|
70962
70962
|
} catch (e2) {
|
|
70963
|
-
|
|
70964
|
-
|
|
70965
|
-
|
|
70966
|
-
|
|
70967
|
-
|
|
70968
|
-
|
|
70969
|
-
|
|
70970
|
-
|
|
70971
|
-
|
|
70963
|
+
try {
|
|
70964
|
+
srcFile = fs2.readFileSync(
|
|
70965
|
+
path4.join(
|
|
70966
|
+
ctx.root,
|
|
70967
|
+
"book",
|
|
70968
|
+
ctx.navigation.current?.path?.directory || "",
|
|
70969
|
+
src
|
|
70970
|
+
),
|
|
70971
|
+
"utf-8"
|
|
70972
|
+
);
|
|
70973
|
+
} catch (e3) {
|
|
70974
|
+
return null;
|
|
70975
|
+
}
|
|
70972
70976
|
}
|
|
70973
70977
|
}
|
|
70974
70978
|
return srcFile;
|
|
@@ -71033,7 +71037,7 @@ ${(code4.scripts ? [cdnLibraryUrl, ...code4.scripts] : []).map((src) => `<script
|
|
|
71033
71037
|
requestJS(file, ["code-input", "indent.min.js"]);
|
|
71034
71038
|
let srcFile = "";
|
|
71035
71039
|
if (src) {
|
|
71036
|
-
srcFile = readFile(src, ctx);
|
|
71040
|
+
srcFile = readFile(src, ctx) || "";
|
|
71037
71041
|
} else if (node3.children?.length > 0) {
|
|
71038
71042
|
srcFile = toText2(node3.children);
|
|
71039
71043
|
}
|
|
@@ -71433,7 +71437,7 @@ var remarkDirectivePyide_default = (ctx) => () => {
|
|
|
71433
71437
|
let tests = [];
|
|
71434
71438
|
let input = "";
|
|
71435
71439
|
if (src) {
|
|
71436
|
-
srcFile = readFile(src, ctx);
|
|
71440
|
+
srcFile = readFile(src, ctx) || "";
|
|
71437
71441
|
} else if (node3.children?.length > 0) {
|
|
71438
71442
|
tests = node3.children.filter((c) => c.type === "code").filter((c) => c.meta?.includes("test")).map((c, i) => ({
|
|
71439
71443
|
code: c.value,
|