@hyperbook/markdown 0.35.1 → 0.36.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/assets/client.js +29 -0
- package/dist/assets/shell.css +59 -0
- package/dist/index.js +8 -1
- package/dist/index.js.map +2 -2
- package/package.json +2 -2
package/dist/assets/client.js
CHANGED
|
@@ -274,9 +274,38 @@ var hyperbook = (function () {
|
|
|
274
274
|
initBookmarks(root);
|
|
275
275
|
}
|
|
276
276
|
|
|
277
|
+
// Check for standalone layout URL parameter or iframe context
|
|
278
|
+
function checkStandaloneMode() {
|
|
279
|
+
// Check if explicitly requested via URL parameter
|
|
280
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
281
|
+
const standaloneParam = urlParams.get('standalone') === 'true';
|
|
282
|
+
|
|
283
|
+
// Check if page is inside an iframe
|
|
284
|
+
const isInIframe = window.self !== window.top;
|
|
285
|
+
|
|
286
|
+
if (standaloneParam || isInIframe) {
|
|
287
|
+
const mainGrid = document.querySelector('.main-grid');
|
|
288
|
+
if (mainGrid && !mainGrid.classList.contains('layout-standalone')) {
|
|
289
|
+
mainGrid.classList.add('layout-standalone');
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
// Hide TOC and QR code buttons when in standalone mode
|
|
293
|
+
const tocToggle = document.getElementById('toc-toggle');
|
|
294
|
+
if (tocToggle) {
|
|
295
|
+
tocToggle.style.display = 'none';
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
const qrcodeOpen = document.getElementById('qrcode-open');
|
|
299
|
+
if (qrcodeOpen) {
|
|
300
|
+
qrcodeOpen.style.display = 'none';
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
|
|
277
305
|
// Initialize existing elements on document load
|
|
278
306
|
document.addEventListener("DOMContentLoaded", () => {
|
|
279
307
|
init(document);
|
|
308
|
+
checkStandaloneMode();
|
|
280
309
|
});
|
|
281
310
|
|
|
282
311
|
// Observe for new elements added to the DOM
|
package/dist/assets/shell.css
CHANGED
|
@@ -807,3 +807,62 @@ nav.toc li.level-3 {
|
|
|
807
807
|
flex-shrink: 0;
|
|
808
808
|
/* Prevent caption from shrinking */
|
|
809
809
|
}
|
|
810
|
+
|
|
811
|
+
/* Wide layout: full width content with drawer-only navigation */
|
|
812
|
+
.main-grid.layout-wide {
|
|
813
|
+
grid-template-columns: 1fr;
|
|
814
|
+
grid-template-areas:
|
|
815
|
+
"header"
|
|
816
|
+
"article";
|
|
817
|
+
|
|
818
|
+
|
|
819
|
+
--main-width: 100%;
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
.main-grid.layout-wide .sidebar {
|
|
823
|
+
display: none;
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
.main-grid.layout-wide .mobile-nav {
|
|
827
|
+
display: flex;
|
|
828
|
+
align-items: center;
|
|
829
|
+
justify-content: center;
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
.main-grid.layout-wide main {
|
|
833
|
+
padding: 20px 40px;
|
|
834
|
+
max-width: 100%;
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
/* Standalone layout: content only, no navigation or header (for iframe embedding) */
|
|
838
|
+
.main-grid.layout-standalone {
|
|
839
|
+
grid-template-columns: 1fr;
|
|
840
|
+
grid-template-rows: 1fr;
|
|
841
|
+
grid-template-areas: "article";
|
|
842
|
+
|
|
843
|
+
--main-width: 100%;
|
|
844
|
+
|
|
845
|
+
#toc-toggle {
|
|
846
|
+
top: inherit;
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
#qrcode-open {
|
|
850
|
+
top: 90px;
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
.main-grid.layout-standalone header,
|
|
855
|
+
.main-grid.layout-standalone .sidebar {
|
|
856
|
+
display: none;
|
|
857
|
+
}
|
|
858
|
+
|
|
859
|
+
.main-grid.layout-standalone main {
|
|
860
|
+
padding: 20px 40px;
|
|
861
|
+
max-width: 100%;
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
.main-grid.layout-standalone .jump-container,
|
|
865
|
+
.main-grid.layout-standalone .meta,
|
|
866
|
+
.main-grid.layout-standalone #custom-links-footer {
|
|
867
|
+
display: none;
|
|
868
|
+
}
|
package/dist/index.js
CHANGED
|
@@ -63837,12 +63837,19 @@ var makeCustomLinksFooter = (ctx) => {
|
|
|
63837
63837
|
var rehypeShell_default = (ctx) => () => {
|
|
63838
63838
|
return (tree, file) => {
|
|
63839
63839
|
const originalChildren = tree.children;
|
|
63840
|
+
const layout = ctx.navigation.current?.layout || "default";
|
|
63841
|
+
let mainGridClass = "main-grid";
|
|
63842
|
+
if (layout === "wide") {
|
|
63843
|
+
mainGridClass = "main-grid layout-wide";
|
|
63844
|
+
} else if (layout === "standalone") {
|
|
63845
|
+
mainGridClass = "main-grid layout-standalone";
|
|
63846
|
+
}
|
|
63840
63847
|
tree.children = [
|
|
63841
63848
|
{
|
|
63842
63849
|
type: "element",
|
|
63843
63850
|
tagName: "div",
|
|
63844
63851
|
properties: {
|
|
63845
|
-
class:
|
|
63852
|
+
class: mainGridClass
|
|
63846
63853
|
},
|
|
63847
63854
|
children: [
|
|
63848
63855
|
...makeHeaderElements(ctx),
|