@hyperbook/markdown 0.33.2 → 0.33.3

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.
@@ -4,7 +4,7 @@ hyperbook.webide = (function () {
4
4
  codeInput.templates.prism(window.Prism, [
5
5
  new codeInput.plugins.AutoCloseBrackets(),
6
6
  new codeInput.plugins.Indent(true, 2),
7
- ])
7
+ ]),
8
8
  );
9
9
 
10
10
  const elems = document.getElementsByClassName("directive-webide");
@@ -71,7 +71,9 @@ hyperbook.webide = (function () {
71
71
 
72
72
  const load = async () => {
73
73
  const result = await store.webide.get(id);
74
- if (!result) return;
74
+ if (!result) {
75
+ return;
76
+ }
75
77
  const website = template
76
78
  .replace("###HTML###", result.html)
77
79
  .replace("###CSS###", result.css)
@@ -94,7 +96,7 @@ hyperbook.webide = (function () {
94
96
  .replace("###JS###", editorJS?.value);
95
97
  frame.srcdoc = website;
96
98
  };
97
-
99
+
98
100
  frame.addEventListener("load", () => {
99
101
  title.textContent = frame.contentDocument.title;
100
102
  });
@@ -105,6 +107,8 @@ hyperbook.webide = (function () {
105
107
  editorHTML.value = result.html;
106
108
  }
107
109
 
110
+ update();
111
+
108
112
  editorHTML.addEventListener("input", () => {
109
113
  update();
110
114
  });
@@ -116,6 +120,8 @@ hyperbook.webide = (function () {
116
120
  editorCSS.value = result.css;
117
121
  }
118
122
 
123
+ update();
124
+
119
125
  editorCSS.addEventListener("input", () => {
120
126
  update();
121
127
  });
@@ -127,6 +133,8 @@ hyperbook.webide = (function () {
127
133
  editorJS.value = result.js;
128
134
  }
129
135
 
136
+ update();
137
+
130
138
  editorJS.addEventListener("input", () => {
131
139
  update();
132
140
  });
package/dist/index.js CHANGED
@@ -70905,6 +70905,9 @@ function node2(value) {
70905
70905
  }
70906
70906
 
70907
70907
  // src/rehypeDirectiveP5.ts
70908
+ function htmlEntities(str) {
70909
+ return String(str).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
70910
+ }
70908
70911
  var rehypeDirectiveP5_default = (ctx) => () => {
70909
70912
  const name = "p5";
70910
70913
  const cdnLibraryUrl = ctx.makeUrl(
@@ -71047,7 +71050,7 @@ ${(code4.scripts ? [cdnLibraryUrl, ...code4.scripts] : []).map((src) => `<script
71047
71050
  children: [
71048
71051
  {
71049
71052
  type: "raw",
71050
- value: srcFile
71053
+ value: htmlEntities(srcFile)
71051
71054
  }
71052
71055
  ]
71053
71056
  },
@@ -71336,6 +71339,9 @@ var remarkDirectiveAbcMusic_default = (ctx) => () => {
71336
71339
  // src/remarkDirectivePyide.ts
71337
71340
  import fs3 from "fs";
71338
71341
  import path5 from "path";
71342
+ function htmlEntities2(str) {
71343
+ return String(str).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
71344
+ }
71339
71345
  var remarkDirectivePyide_default = (ctx) => () => {
71340
71346
  const name = "pyide";
71341
71347
  return (tree, file) => {
@@ -71501,7 +71507,7 @@ var remarkDirectivePyide_default = (ctx) => () => {
71501
71507
  children: [
71502
71508
  {
71503
71509
  type: "raw",
71504
- value: srcFile
71510
+ value: htmlEntities2(srcFile)
71505
71511
  }
71506
71512
  ]
71507
71513
  },
@@ -71562,6 +71568,9 @@ var remarkDirectivePyide_default = (ctx) => () => {
71562
71568
  };
71563
71569
 
71564
71570
  // src/remarkDirectiveWebide.ts
71571
+ function htmlEntities3(str) {
71572
+ return String(str).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
71573
+ }
71565
71574
  var remarkDirectiveWebide_default = (ctx) => () => {
71566
71575
  const name = "webide";
71567
71576
  const makeWrapInMarkupTemplate = () => `<!DOCTYPE html>
@@ -71610,7 +71619,6 @@ html, body {
71610
71619
  const buttons = [];
71611
71620
  const editors = [];
71612
71621
  if (htmlNode) {
71613
- html13 = htmlNode.value;
71614
71622
  buttons.push({
71615
71623
  type: "element",
71616
71624
  tagName: "button",
@@ -71635,7 +71643,7 @@ html, body {
71635
71643
  children: [
71636
71644
  {
71637
71645
  type: "raw",
71638
- value: html13
71646
+ value: htmlEntities3(htmlNode.value)
71639
71647
  }
71640
71648
  ]
71641
71649
  });
@@ -71666,7 +71674,7 @@ html, body {
71666
71674
  children: [
71667
71675
  {
71668
71676
  type: "raw",
71669
- value: css
71677
+ value: htmlEntities3(css)
71670
71678
  }
71671
71679
  ]
71672
71680
  });
@@ -71697,7 +71705,7 @@ html, body {
71697
71705
  children: [
71698
71706
  {
71699
71707
  type: "raw",
71700
- value: js
71708
+ value: htmlEntities3(js)
71701
71709
  }
71702
71710
  ]
71703
71711
  });
@@ -78527,6 +78535,9 @@ var remark = (ctx) => {
78527
78535
  remarkRemoveComments,
78528
78536
  remarkDirective,
78529
78537
  dist_default,
78538
+ remarkDirectivePyide_default(ctx),
78539
+ remarkDirectiveWebide_default(ctx),
78540
+ remarkDirectiveOnlineIde_default(ctx),
78530
78541
  remarkDirectivePagelist_default(ctx),
78531
78542
  remarkLink_default(ctx),
78532
78543
  remarkImageAttrs_default(ctx),
@@ -78547,8 +78558,6 @@ var remark = (ctx) => {
78547
78558
  remarkDirectiveTiles_default(ctx),
78548
78559
  remarkDirectiveTabs_default(ctx),
78549
78560
  remarkDirectiveSqlIde_default(ctx),
78550
- remarkDirectivePyide_default(ctx),
78551
- remarkDirectiveOnlineIde_default(ctx),
78552
78561
  remarkDirectivePlantuml_default(ctx),
78553
78562
  remarkDirectiveSlideshow_default(ctx),
78554
78563
  remarkDirectiveScratchblock_default(ctx),
@@ -78557,7 +78566,6 @@ var remark = (ctx) => {
78557
78566
  remarkDirectiveExcalidraw_default(ctx),
78558
78567
  remarkDirectiveStruktog_default(ctx),
78559
78568
  remarkDirectiveGeogebra_default(ctx),
78560
- remarkDirectiveWebide_default(ctx),
78561
78569
  remarkDirectiveH5P_default(ctx),
78562
78570
  remarkDirectiveJSXGraph_default(ctx),
78563
78571
  remarkDirectiveMultievent_default(ctx),