@hyperbook/markdown 0.42.0 → 0.42.2
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/assets/client.js +3 -2
- package/dist/helper.d.ts +1 -1
- package/dist/index.js +16 -16
- package/dist/index.js.map +2 -2
- package/package.json +1 -1
package/dist/assets/client.js
CHANGED
|
@@ -280,8 +280,9 @@ var hyperbook = (function () {
|
|
|
280
280
|
const urlParams = new URLSearchParams(window.location.search);
|
|
281
281
|
const standaloneParam = urlParams.get('standalone') === 'true';
|
|
282
282
|
|
|
283
|
-
// Check if page is inside an iframe
|
|
284
|
-
const
|
|
283
|
+
// Check if page is inside an iframe (but not VSCode webview)
|
|
284
|
+
const isVSCodeWebview = typeof acquireVsCodeApi !== 'undefined';
|
|
285
|
+
const isInIframe = window.self !== window.top && !isVSCodeWebview;
|
|
285
286
|
|
|
286
287
|
if (standaloneParam || isInIframe) {
|
|
287
288
|
const mainGrid = document.querySelector('.main-grid');
|
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
|
@@ -64025,11 +64025,7 @@ var remarkImage_default = (ctx) => () => {
|
|
|
64025
64025
|
tagName: "img",
|
|
64026
64026
|
properties: {
|
|
64027
64027
|
...figureProps,
|
|
64028
|
-
src:
|
|
64029
|
-
node3.url,
|
|
64030
|
-
"public",
|
|
64031
|
-
ctx.navigation.current || void 0
|
|
64032
|
-
),
|
|
64028
|
+
src: node3.url,
|
|
64033
64029
|
alt: node3.alt,
|
|
64034
64030
|
onclick: `hyperbook.toggleLightbox(this)`
|
|
64035
64031
|
},
|
|
@@ -70960,15 +70956,19 @@ var readFile = (src, ctx) => {
|
|
|
70960
70956
|
try {
|
|
70961
70957
|
srcFile = fs2.readFileSync(path4.join(ctx.root, "book", src), "utf-8");
|
|
70962
70958
|
} catch (e2) {
|
|
70963
|
-
|
|
70964
|
-
|
|
70965
|
-
|
|
70966
|
-
|
|
70967
|
-
|
|
70968
|
-
|
|
70969
|
-
|
|
70970
|
-
|
|
70971
|
-
|
|
70959
|
+
try {
|
|
70960
|
+
srcFile = fs2.readFileSync(
|
|
70961
|
+
path4.join(
|
|
70962
|
+
ctx.root,
|
|
70963
|
+
"book",
|
|
70964
|
+
ctx.navigation.current?.path?.directory || "",
|
|
70965
|
+
src
|
|
70966
|
+
),
|
|
70967
|
+
"utf-8"
|
|
70968
|
+
);
|
|
70969
|
+
} catch (e3) {
|
|
70970
|
+
return null;
|
|
70971
|
+
}
|
|
70972
70972
|
}
|
|
70973
70973
|
}
|
|
70974
70974
|
return srcFile;
|
|
@@ -71033,7 +71033,7 @@ ${(code4.scripts ? [cdnLibraryUrl, ...code4.scripts] : []).map((src) => `<script
|
|
|
71033
71033
|
requestJS(file, ["code-input", "indent.min.js"]);
|
|
71034
71034
|
let srcFile = "";
|
|
71035
71035
|
if (src) {
|
|
71036
|
-
srcFile = readFile(src, ctx);
|
|
71036
|
+
srcFile = readFile(src, ctx) || "";
|
|
71037
71037
|
} else if (node3.children?.length > 0) {
|
|
71038
71038
|
srcFile = toText2(node3.children);
|
|
71039
71039
|
}
|
|
@@ -71433,7 +71433,7 @@ var remarkDirectivePyide_default = (ctx) => () => {
|
|
|
71433
71433
|
let tests = [];
|
|
71434
71434
|
let input = "";
|
|
71435
71435
|
if (src) {
|
|
71436
|
-
srcFile = readFile(src, ctx);
|
|
71436
|
+
srcFile = readFile(src, ctx) || "";
|
|
71437
71437
|
} else if (node3.children?.length > 0) {
|
|
71438
71438
|
tests = node3.children.filter((c) => c.type === "code").filter((c) => c.meta?.includes("test")).map((c, i) => ({
|
|
71439
71439
|
code: c.value,
|