@hyperbook/markdown 0.11.2 → 0.12.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/assets/client.js +29 -0
- package/dist/assets/content.css +90 -3
- package/dist/assets/qrcode.js +424 -0
- package/dist/index.js +126 -1
- package/dist/index.js.map +3 -3
- package/dist/rehypeQrCode.d.ts +5 -0
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -63433,6 +63433,9 @@ var rehypeTableOfContents_default = (ctx) => () => {
|
|
|
63433
63433
|
return (tree, file) => {
|
|
63434
63434
|
const headings = file.data.headings || [];
|
|
63435
63435
|
const originalChildren = tree.children;
|
|
63436
|
+
if (!showToc) {
|
|
63437
|
+
return;
|
|
63438
|
+
}
|
|
63436
63439
|
const tocSidebar = [
|
|
63437
63440
|
{
|
|
63438
63441
|
type: "element",
|
|
@@ -64360,7 +64363,17 @@ HYPERBOOK_ASSETS = "${makeUrl("/", "assets")}"
|
|
|
64360
64363
|
tagName: "script",
|
|
64361
64364
|
properties: {
|
|
64362
64365
|
type: "module",
|
|
64363
|
-
src: makeUrl(["side-drawer.js"], "assets")
|
|
64366
|
+
src: makeUrl(["side-drawer.js"], "assets"),
|
|
64367
|
+
async: true
|
|
64368
|
+
},
|
|
64369
|
+
children: []
|
|
64370
|
+
},
|
|
64371
|
+
{
|
|
64372
|
+
type: "element",
|
|
64373
|
+
tagName: "script",
|
|
64374
|
+
properties: {
|
|
64375
|
+
src: makeUrl(["qrcode.js"], "assets"),
|
|
64376
|
+
async: true
|
|
64364
64377
|
},
|
|
64365
64378
|
children: []
|
|
64366
64379
|
},
|
|
@@ -65914,6 +65927,8 @@ var remarkDirectiveQr_default = (ctx) => () => {
|
|
|
65914
65927
|
padding: 0,
|
|
65915
65928
|
width: realSizes[safeSize],
|
|
65916
65929
|
height: realSizes[safeSize],
|
|
65930
|
+
join: true,
|
|
65931
|
+
container: "svg-viewbox",
|
|
65917
65932
|
color: "#000000",
|
|
65918
65933
|
background: "#ffffff",
|
|
65919
65934
|
ecl: "M"
|
|
@@ -72049,6 +72064,115 @@ var remarkDirectivePagelist_default = (ctx) => () => {
|
|
|
72049
72064
|
};
|
|
72050
72065
|
};
|
|
72051
72066
|
|
|
72067
|
+
// src/rehypeQrCode.ts
|
|
72068
|
+
var rehypeQrCode_default = (ctx) => () => {
|
|
72069
|
+
const qrcode = ctx.config.qrcode || ctx.navigation.current?.qrcode || true;
|
|
72070
|
+
return (tree, file) => {
|
|
72071
|
+
const originalChildren = tree.children;
|
|
72072
|
+
if (!qrcode || !ctx.navigation.current?.href) {
|
|
72073
|
+
return;
|
|
72074
|
+
}
|
|
72075
|
+
const qrcodeDialog = [
|
|
72076
|
+
{
|
|
72077
|
+
type: "element",
|
|
72078
|
+
tagName: "button",
|
|
72079
|
+
properties: {
|
|
72080
|
+
id: "qrcode-open",
|
|
72081
|
+
onclick: "hyperbook.qrcodeOpen()",
|
|
72082
|
+
title: "QR-Code"
|
|
72083
|
+
},
|
|
72084
|
+
children: [
|
|
72085
|
+
{
|
|
72086
|
+
type: "element",
|
|
72087
|
+
tagName: "div",
|
|
72088
|
+
properties: {
|
|
72089
|
+
class: "qrcode-icon"
|
|
72090
|
+
},
|
|
72091
|
+
children: []
|
|
72092
|
+
}
|
|
72093
|
+
]
|
|
72094
|
+
},
|
|
72095
|
+
{
|
|
72096
|
+
type: "element",
|
|
72097
|
+
tagName: "dialog",
|
|
72098
|
+
properties: {
|
|
72099
|
+
id: "qrcode-dialog"
|
|
72100
|
+
},
|
|
72101
|
+
children: [
|
|
72102
|
+
{
|
|
72103
|
+
type: "element",
|
|
72104
|
+
tagName: "div",
|
|
72105
|
+
properties: {
|
|
72106
|
+
class: "container"
|
|
72107
|
+
},
|
|
72108
|
+
children: [
|
|
72109
|
+
{
|
|
72110
|
+
type: "element",
|
|
72111
|
+
tagName: "div",
|
|
72112
|
+
properties: {
|
|
72113
|
+
class: "name"
|
|
72114
|
+
},
|
|
72115
|
+
children: [
|
|
72116
|
+
{
|
|
72117
|
+
type: "text",
|
|
72118
|
+
value: ctx.navigation.current.name || ctx.config.name
|
|
72119
|
+
}
|
|
72120
|
+
]
|
|
72121
|
+
},
|
|
72122
|
+
{
|
|
72123
|
+
type: "element",
|
|
72124
|
+
tagName: "div",
|
|
72125
|
+
properties: {
|
|
72126
|
+
class: "make-qrcode"
|
|
72127
|
+
},
|
|
72128
|
+
children: []
|
|
72129
|
+
},
|
|
72130
|
+
{
|
|
72131
|
+
type: "element",
|
|
72132
|
+
tagName: "div",
|
|
72133
|
+
properties: {
|
|
72134
|
+
class: "url"
|
|
72135
|
+
},
|
|
72136
|
+
children: [
|
|
72137
|
+
{
|
|
72138
|
+
type: "text",
|
|
72139
|
+
value: `${ctx.makeUrl(
|
|
72140
|
+
ctx.navigation.current?.href || "",
|
|
72141
|
+
"public"
|
|
72142
|
+
)}`
|
|
72143
|
+
}
|
|
72144
|
+
]
|
|
72145
|
+
}
|
|
72146
|
+
]
|
|
72147
|
+
},
|
|
72148
|
+
{
|
|
72149
|
+
type: "element",
|
|
72150
|
+
tagName: "button",
|
|
72151
|
+
properties: {
|
|
72152
|
+
class: "close",
|
|
72153
|
+
onclick: "hyperbook.qrcodeClose()"
|
|
72154
|
+
},
|
|
72155
|
+
children: [
|
|
72156
|
+
{
|
|
72157
|
+
type: "element",
|
|
72158
|
+
tagName: "div",
|
|
72159
|
+
properties: {
|
|
72160
|
+
class: "close-icon"
|
|
72161
|
+
},
|
|
72162
|
+
children: []
|
|
72163
|
+
}
|
|
72164
|
+
]
|
|
72165
|
+
}
|
|
72166
|
+
]
|
|
72167
|
+
}
|
|
72168
|
+
];
|
|
72169
|
+
if (originalChildren[0].type === "element" && originalChildren[0].tagName === "div") {
|
|
72170
|
+
originalChildren[0].children.push(...qrcodeDialog);
|
|
72171
|
+
}
|
|
72172
|
+
tree.children = originalChildren;
|
|
72173
|
+
};
|
|
72174
|
+
};
|
|
72175
|
+
|
|
72052
72176
|
// src/process.ts
|
|
72053
72177
|
var remark = (ctx) => {
|
|
72054
72178
|
const remarkPlugins = [
|
|
@@ -72091,6 +72215,7 @@ var remark = (ctx) => {
|
|
|
72091
72215
|
];
|
|
72092
72216
|
const rehypePlugins = [
|
|
72093
72217
|
rehypeTableOfContents_default(ctx),
|
|
72218
|
+
rehypeQrCode_default(ctx),
|
|
72094
72219
|
rehypeKatex,
|
|
72095
72220
|
[
|
|
72096
72221
|
src_default,
|