hyperbook 0.89.2 → 0.90.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.
@@ -54,7 +54,7 @@ hyperbook.protect = (function () {
54
54
  function init(root) {
55
55
  const els = root.getElementsByClassName("directive-protect");
56
56
  for (let el of els) {
57
- const inputEl = el.getElementsByTagName("input")[0];
57
+ const inputEl = el.querySelector(":scope > .password-input input");
58
58
  const id = el.getAttribute("data-id");
59
59
 
60
60
  if (!inputEl) continue;
@@ -66,7 +66,7 @@ hyperbook.protect = (function () {
66
66
  }
67
67
  });
68
68
 
69
- const hiddenEL = el.getElementsByClassName("hidden")[0];
69
+ const hiddenEL = el.querySelector(":scope > .hidden");
70
70
  el.removeChild(hiddenEL);
71
71
 
72
72
  onUpdateToast(inputEl, el, hiddenEL);
package/dist/index.js CHANGED
@@ -55420,7 +55420,13 @@ async function buildSingleBookPage(file, baseCtx, pageList, pagesAndSections, ro
55420
55420
  const permaOut = path_1.default.join(rootOut, "@");
55421
55421
  await (0, make_dir_1.makeDir)(permaOut, { recursive: true });
55422
55422
  const permaFileOut = path_1.default.join(permaOut, file.markdown.data.permaid + ".html");
55423
- await promises_1.default.writeFile(permaFileOut, result.value);
55423
+ const redirectUrl = path_1.posix.join("/", hyperbookJson.basePath || "", file.path.href || "");
55424
+ const redirectHtml = `<!DOCTYPE html>
55425
+ <meta charset="utf-8">
55426
+ <meta http-equiv="refresh" content="0; url=${redirectUrl}">
55427
+ <link rel="canonical" href="${redirectUrl}">
55428
+ `;
55429
+ await promises_1.default.writeFile(permaFileOut, redirectHtml);
55424
55430
  }
55425
55431
  await promises_1.default.writeFile(fileOut, result.value);
55426
55432
  return { searchDocuments, directives };
@@ -171310,6 +171316,166 @@ function remarkGfm(options2) {
171310
171316
  toMarkdownExtensions.push(gfmToMarkdown(settings));
171311
171317
  }
171312
171318
 
171319
+ // src/langs/hyperbook.tmLanguage.json
171320
+ var hyperbook_tmLanguage_default = {
171321
+ $schema: "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
171322
+ name: "hyperbook",
171323
+ scopeName: "source.hyperbook",
171324
+ patterns: [
171325
+ { include: "#frontmatter" },
171326
+ { include: "#container-directive" },
171327
+ { include: "#leaf-directive" },
171328
+ { include: "#inline-directive" },
171329
+ { include: "text.html.markdown" }
171330
+ ],
171331
+ repository: {
171332
+ frontmatter: {
171333
+ name: "markup.raw.yaml.front-matter.hyperbook",
171334
+ begin: "\\A(-{3})\\s*$",
171335
+ beginCaptures: {
171336
+ "1": {
171337
+ name: "punctuation.definition.frontmatter.hyperbook"
171338
+ }
171339
+ },
171340
+ end: "^(-{3})\\s*$",
171341
+ endCaptures: {
171342
+ "1": {
171343
+ name: "punctuation.definition.frontmatter.hyperbook"
171344
+ }
171345
+ },
171346
+ patterns: [{ include: "source.yaml" }]
171347
+ },
171348
+ "container-directive": {
171349
+ name: "meta.directive.container.hyperbook",
171350
+ begin: "(^|\\G)(:{3,})([a-zA-Z][\\w-]*)(\\{[^}]*\\})?\\s*$",
171351
+ end: "(^|\\G)(\\2)\\s*$",
171352
+ beginCaptures: {
171353
+ "2": {
171354
+ name: "punctuation.definition.directive.hyperbook"
171355
+ },
171356
+ "3": {
171357
+ name: "entity.name.function.directive.hyperbook"
171358
+ },
171359
+ "4": {
171360
+ patterns: [{ include: "#directive-attributes" }]
171361
+ }
171362
+ },
171363
+ endCaptures: {
171364
+ "2": {
171365
+ name: "punctuation.definition.directive.hyperbook"
171366
+ }
171367
+ },
171368
+ patterns: [{ include: "$self" }]
171369
+ },
171370
+ "leaf-directive": {
171371
+ name: "meta.directive.leaf.hyperbook",
171372
+ match: "(^|\\G)(:{2})([a-zA-Z][\\w-]*)(\\[[^\\]]*\\])?(\\{[^}]*\\})?\\s*$",
171373
+ captures: {
171374
+ "2": {
171375
+ name: "punctuation.definition.directive.hyperbook"
171376
+ },
171377
+ "3": {
171378
+ name: "entity.name.function.directive.hyperbook"
171379
+ },
171380
+ "4": {
171381
+ patterns: [{ include: "#directive-label" }]
171382
+ },
171383
+ "5": {
171384
+ patterns: [{ include: "#directive-attributes" }]
171385
+ }
171386
+ }
171387
+ },
171388
+ "inline-directive": {
171389
+ name: "meta.directive.inline.hyperbook",
171390
+ match: "(?<!:)(:)([a-zA-Z][\\w-]*)(\\[[^\\]]*\\])?(\\{[^}]*\\})?",
171391
+ captures: {
171392
+ "1": {
171393
+ name: "punctuation.definition.directive.hyperbook"
171394
+ },
171395
+ "2": {
171396
+ name: "entity.name.function.directive.hyperbook"
171397
+ },
171398
+ "3": {
171399
+ patterns: [{ include: "#directive-label" }]
171400
+ },
171401
+ "4": {
171402
+ patterns: [{ include: "#directive-attributes" }]
171403
+ }
171404
+ }
171405
+ },
171406
+ "directive-attributes": {
171407
+ match: "\\{([^}]*)\\}",
171408
+ captures: {
171409
+ "0": {
171410
+ name: "meta.directive.attributes.hyperbook"
171411
+ },
171412
+ "1": {
171413
+ patterns: [
171414
+ {
171415
+ name: "variable.other.directive.id.hyperbook",
171416
+ match: "#[a-zA-Z][\\w-]*"
171417
+ },
171418
+ {
171419
+ name: "entity.other.attribute-name.class.hyperbook",
171420
+ match: "\\.[a-zA-Z][\\w-]*"
171421
+ },
171422
+ {
171423
+ match: '([a-zA-Z][\\w-]*)\\s*=\\s*"([^"]*)"',
171424
+ captures: {
171425
+ "1": {
171426
+ name: "entity.other.attribute-name.hyperbook"
171427
+ },
171428
+ "2": {
171429
+ name: "string.quoted.double.hyperbook"
171430
+ }
171431
+ }
171432
+ },
171433
+ {
171434
+ match: "([a-zA-Z][\\w-]*)\\s*=\\s*(?:(true|false)|([0-9]+))",
171435
+ captures: {
171436
+ "1": {
171437
+ name: "entity.other.attribute-name.hyperbook"
171438
+ },
171439
+ "2": {
171440
+ name: "constant.language.boolean.hyperbook"
171441
+ },
171442
+ "3": {
171443
+ name: "constant.numeric.hyperbook"
171444
+ }
171445
+ }
171446
+ },
171447
+ {
171448
+ match: '([a-zA-Z][\\w-]*)\\s*=\\s*([^\\s}"]+)',
171449
+ captures: {
171450
+ "1": {
171451
+ name: "entity.other.attribute-name.hyperbook"
171452
+ },
171453
+ "2": {
171454
+ name: "string.unquoted.hyperbook"
171455
+ }
171456
+ }
171457
+ }
171458
+ ]
171459
+ }
171460
+ }
171461
+ },
171462
+ "directive-label": {
171463
+ match: "(\\[)([^\\]]*)(\\])",
171464
+ captures: {
171465
+ "1": {
171466
+ name: "punctuation.definition.label.begin.hyperbook"
171467
+ },
171468
+ "2": {
171469
+ name: "string.other.directive.label.hyperbook"
171470
+ },
171471
+ "3": {
171472
+ name: "punctuation.definition.label.end.hyperbook"
171473
+ }
171474
+ }
171475
+ }
171476
+ }
171477
+ };
171478
+
171313
171479
  // ../../node_modules/.pnpm/character-reference-invalid@2.0.1/node_modules/character-reference-invalid/index.js
171314
171480
  var characterReferenceInvalid = {
171315
171481
  0: "\uFFFD",
@@ -201488,7 +201654,19 @@ var process3 = (md, ctx) => {
201488
201654
  theme: ctx.config.elements?.code?.theme || {
201489
201655
  dark: `github-dark`,
201490
201656
  light: `github-light`
201491
- }
201657
+ },
201658
+ getHighlighter: (options2) => getSingletonHighlighter({
201659
+ ...options2,
201660
+ langs: [
201661
+ ...options2?.langs || [],
201662
+ "markdown",
201663
+ "yaml",
201664
+ {
201665
+ ...hyperbook_tmLanguage_default,
201666
+ embeddedLangsLazy: ["markdown", "yaml"]
201667
+ }
201668
+ ]
201669
+ })
201492
201670
  }
201493
201671
  ],
201494
201672
  rehypeFormat
@@ -201553,7 +201731,7 @@ module.exports = /*#__PURE__*/JSON.parse('{"application/1d-interleaved-parityfec
201553
201731
  /***/ ((module) => {
201554
201732
 
201555
201733
  "use strict";
201556
- module.exports = /*#__PURE__*/JSON.parse('{"name":"hyperbook","version":"0.89.2","author":"Mike Barkmin","homepage":"https://github.com/openpatch/hyperbook#readme","license":"MIT","bin":{"hyperbook":"./dist/index.js"},"files":["dist"],"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/openpatch/hyperbook.git","directory":"packages/hyperbook"},"bugs":{"url":"https://github.com/openpatch/hyperbook/issues"},"engines":{"node":">=18"},"scripts":{"version":"pnpm build","lint":"tsc --noEmit","dev":"ncc build ./index.ts -w -o dist/","build":"rimraf dist && ncc build ./index.ts -o ./dist/ --no-cache --no-source-map-register --external favicons --external sharp && node postbuild.mjs"},"dependencies":{"favicons":"^7.2.0"},"devDependencies":{"create-hyperbook":"workspace:*","@hyperbook/fs":"workspace:*","@hyperbook/markdown":"workspace:*","@hyperbook/types":"workspace:*","@pnpm/exportable-manifest":"1000.0.6","@types/archiver":"6.0.3","@types/async-retry":"1.4.9","@types/cross-spawn":"6.0.6","@types/lunr":"^2.3.7","@types/prompts":"2.4.9","@types/tar":"6.1.13","@types/ws":"^8.5.14","@vercel/ncc":"0.38.3","archiver":"7.0.1","async-retry":"1.3.3","chalk":"5.4.1","chokidar":"4.0.3","commander":"12.1.0","cpy":"11.1.0","cross-spawn":"7.0.6","domutils":"^3.2.2","extract-zip":"^2.0.1","got":"12.6.0","htmlparser2":"^10.0.0","lunr":"^2.3.9","lunr-languages":"^1.14.0","mime":"^4.0.6","prompts":"2.4.2","rimraf":"6.0.1","tar":"7.4.3","update-check":"1.5.4","ws":"^8.18.0"}}');
201734
+ module.exports = /*#__PURE__*/JSON.parse('{"name":"hyperbook","version":"0.90.0","author":"Mike Barkmin","homepage":"https://github.com/openpatch/hyperbook#readme","license":"MIT","bin":{"hyperbook":"./dist/index.js"},"files":["dist"],"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/openpatch/hyperbook.git","directory":"packages/hyperbook"},"bugs":{"url":"https://github.com/openpatch/hyperbook/issues"},"engines":{"node":">=18"},"scripts":{"version":"pnpm build","lint":"tsc --noEmit","dev":"ncc build ./index.ts -w -o dist/","build":"rimraf dist && ncc build ./index.ts -o ./dist/ --no-cache --no-source-map-register --external favicons --external sharp && node postbuild.mjs"},"dependencies":{"favicons":"^7.2.0"},"devDependencies":{"create-hyperbook":"workspace:*","@hyperbook/fs":"workspace:*","@hyperbook/markdown":"workspace:*","@hyperbook/types":"workspace:*","@pnpm/exportable-manifest":"1000.0.6","@types/archiver":"6.0.3","@types/async-retry":"1.4.9","@types/cross-spawn":"6.0.6","@types/lunr":"^2.3.7","@types/prompts":"2.4.9","@types/tar":"6.1.13","@types/ws":"^8.5.14","@vercel/ncc":"0.38.3","archiver":"7.0.1","async-retry":"1.3.3","chalk":"5.4.1","chokidar":"4.0.3","commander":"12.1.0","cpy":"11.1.0","cross-spawn":"7.0.6","domutils":"^3.2.2","extract-zip":"^2.0.1","got":"12.6.0","htmlparser2":"^10.0.0","lunr":"^2.3.9","lunr-languages":"^1.14.0","mime":"^4.0.6","prompts":"2.4.2","rimraf":"6.0.1","tar":"7.4.3","update-check":"1.5.4","ws":"^8.18.0"}}');
201557
201735
 
201558
201736
  /***/ })
201559
201737
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hyperbook",
3
- "version": "0.89.2",
3
+ "version": "0.90.0",
4
4
  "author": "Mike Barkmin",
5
5
  "homepage": "https://github.com/openpatch/hyperbook#readme",
6
6
  "license": "MIT",
@@ -57,7 +57,7 @@
57
57
  "update-check": "1.5.4",
58
58
  "ws": "^8.18.0",
59
59
  "create-hyperbook": "0.3.6",
60
- "@hyperbook/markdown": "0.60.2",
60
+ "@hyperbook/markdown": "0.61.0",
61
61
  "@hyperbook/types": "0.23.0",
62
62
  "@hyperbook/fs": "0.25.0"
63
63
  },