@hyperbook/markdown 0.35.0 → 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.
@@ -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
@@ -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
@@ -62554,6 +62554,35 @@ var rehypeHtmlStructure_default = (ctx) => () => {
62554
62554
  },
62555
62555
  children: []
62556
62556
  },
62557
+ {
62558
+ type: "element",
62559
+ tagName: "link",
62560
+ properties: {
62561
+ rel: "icon",
62562
+ type: "image/x-icon",
62563
+ href: makeUrl(["favicon.ico"], "public")
62564
+ },
62565
+ children: []
62566
+ },
62567
+ {
62568
+ type: "element",
62569
+ tagName: "link",
62570
+ properties: {
62571
+ rel: "apple-touch-icon",
62572
+ sizes: "180x180",
62573
+ href: makeUrl(["favicons", "apple-touch-icon.png"], "assets")
62574
+ },
62575
+ children: []
62576
+ },
62577
+ {
62578
+ type: "element",
62579
+ tagName: "link",
62580
+ properties: {
62581
+ rel: "manifest",
62582
+ href: makeUrl(["favicons", "manifest.webmanifest"], "assets")
62583
+ },
62584
+ children: []
62585
+ },
62557
62586
  {
62558
62587
  type: "element",
62559
62588
  tagName: "link",
@@ -63808,12 +63837,19 @@ var makeCustomLinksFooter = (ctx) => {
63808
63837
  var rehypeShell_default = (ctx) => () => {
63809
63838
  return (tree, file) => {
63810
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
+ }
63811
63847
  tree.children = [
63812
63848
  {
63813
63849
  type: "element",
63814
63850
  tagName: "div",
63815
63851
  properties: {
63816
- class: "main-grid"
63852
+ class: mainGridClass
63817
63853
  },
63818
63854
  children: [
63819
63855
  ...makeHeaderElements(ctx),