@brillout/docpress 0.3.7 → 0.3.9

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/index.d.ts CHANGED
@@ -90,13 +90,6 @@ declare function Link(props: {
90
90
  doNotInferSectionTitle?: true;
91
91
  }): JSX.Element;
92
92
 
93
- declare function DocLink({ href, text, noBreadcrumb, doNotInferSectionTitle }: {
94
- href: string;
95
- text?: string | JSX.Element;
96
- noBreadcrumb?: true;
97
- doNotInferSectionTitle?: true;
98
- }): JSX.Element;
99
-
100
93
  declare function isRepoLink(href: string): boolean;
101
94
  declare function RepoLink({ path, text, editMode }: {
102
95
  path: string;
@@ -147,4 +140,4 @@ declare function CodeBlock({ children, lineBreak }: {
147
140
  lineBreak?: true;
148
141
  }): JSX.Element;
149
142
 
150
- export { CodeBlock, Config, DocLink, Emoji, EmojiName, HeadingDefinition, HeadingWithoutLink, HorizontalLine, ImportMeta, Info, Link, Note, P, ReadingRecommendation, RepoLink, Sponsor, Sponsors, assert, assertUsage, assertWarning, crawlAllFiles, determineSectionTitle, determineSectionUrlHash, filter, isBrowser, isRepoLink, jsxToTextContent, objectAssign };
143
+ export { CodeBlock, Config, Emoji, EmojiName, HeadingDefinition, HeadingWithoutLink, HorizontalLine, ImportMeta, Info, Link, Note, P, ReadingRecommendation, RepoLink, Sponsor, Sponsors, assert, assertUsage, assertWarning, crawlAllFiles, determineSectionTitle, determineSectionUrlHash, filter, isBrowser, isRepoLink, jsxToTextContent, objectAssign };
package/dist/index.js CHANGED
@@ -26,10 +26,19 @@ import {
26
26
  import "./chunk-3QC7HYIF.js";
27
27
 
28
28
  // src/components/Link.tsx
29
- import React2 from "react";
30
-
31
- // src/components/DocLink.tsx
32
29
  import React from "react";
30
+ function Link(props) {
31
+ if (isRepoLink(props.href)) {
32
+ return /* @__PURE__ */ React.createElement(RepoLink, {
33
+ path: props.href,
34
+ text: props.text
35
+ });
36
+ } else {
37
+ return /* @__PURE__ */ React.createElement(DocLink, {
38
+ ...props
39
+ });
40
+ }
41
+ }
33
42
  function DocLink({
34
43
  href,
35
44
  text,
@@ -52,8 +61,20 @@ function getTitle({
52
61
  if (href.includes("#")) {
53
62
  ;
54
63
  [hrefWithoutHash, urlHash] = href.split("#");
64
+ assert(hrefWithoutHash || urlHash);
55
65
  }
56
- const heading = findHeading(hrefWithoutHash, pageContext);
66
+ let heading;
67
+ let linkIsOnSamePage;
68
+ if (hrefWithoutHash) {
69
+ heading = findHeading(hrefWithoutHash, pageContext);
70
+ linkIsOnSamePage = heading.url === pageContext.urlPathname;
71
+ } else {
72
+ assert(urlHash);
73
+ linkIsOnSamePage = true;
74
+ heading = pageContext.activeHeading;
75
+ }
76
+ assert(heading);
77
+ assert(heading === pageContext.activeHeading || !linkIsOnSamePage);
57
78
  const breadcrumbs = [];
58
79
  if ("parentHeadings" in heading) {
59
80
  breadcrumbs.push(
@@ -80,7 +101,6 @@ function getTitle({
80
101
  breadcrumbs.push(sectionTitle);
81
102
  }
82
103
  {
83
- const linkIsOnSamePage = heading.url === pageContext.urlPathname;
84
104
  if (noBreadcrumb || linkIsOnSamePage) {
85
105
  return breadcrumbs[breadcrumbs.length - 1];
86
106
  }
@@ -106,70 +126,56 @@ function findHeading(href, pageContext) {
106
126
  return heading;
107
127
  }
108
128
 
109
- // src/components/Link.tsx
110
- function Link(props) {
111
- if (isRepoLink(props.href)) {
112
- return /* @__PURE__ */ React2.createElement(RepoLink, {
113
- path: props.href,
114
- text: props.text
115
- });
116
- } else {
117
- return /* @__PURE__ */ React2.createElement(DocLink, {
118
- ...props
119
- });
120
- }
121
- }
122
-
123
129
  // src/components/P.tsx
124
- import React3 from "react";
130
+ import React2 from "react";
125
131
  function P(props) {
126
- return /* @__PURE__ */ React3.createElement("div", {
132
+ return /* @__PURE__ */ React2.createElement("div", {
127
133
  ...props,
128
134
  className: "paragraph"
129
135
  });
130
136
  }
131
137
 
132
138
  // src/components/Info.tsx
133
- import React4 from "react";
139
+ import React3 from "react";
134
140
  function Info({ children }) {
135
- return /* @__PURE__ */ React4.createElement("blockquote", null, /* @__PURE__ */ React4.createElement(P, null, children));
141
+ return /* @__PURE__ */ React3.createElement("blockquote", null, /* @__PURE__ */ React3.createElement(P, null, children));
136
142
  }
137
143
 
138
144
  // src/components/ReadingRecommendation.tsx
139
- import React5 from "react";
145
+ import React4 from "react";
140
146
  function ReadingRecommendation({ tour, links }) {
141
147
  const multiple = links.length + (tour ? 1 : 0) > 1;
142
- return /* @__PURE__ */ React5.createElement(Info, null, multiple ? " " : "", /* @__PURE__ */ React5.createElement("b", null, "Reading Recommendation", multiple ? "." : ": "), (() => {
148
+ return /* @__PURE__ */ React4.createElement(Info, null, multiple ? " " : "", /* @__PURE__ */ React4.createElement("b", null, "Reading Recommendation", multiple ? "." : ": "), (() => {
143
149
  if (!multiple) {
144
- const link = tour ? /* @__PURE__ */ React5.createElement(TourLink, null) : /* @__PURE__ */ React5.createElement(Link, {
150
+ const link = tour ? /* @__PURE__ */ React4.createElement(TourLink, null) : /* @__PURE__ */ React4.createElement(Link, {
145
151
  href: links[0]
146
152
  });
147
- return /* @__PURE__ */ React5.createElement(React5.Fragment, null, link, ".");
153
+ return /* @__PURE__ */ React4.createElement(React4.Fragment, null, link, ".");
148
154
  }
149
- return /* @__PURE__ */ React5.createElement("ul", {
155
+ return /* @__PURE__ */ React4.createElement("ul", {
150
156
  style: {
151
157
  marginLeft: 18,
152
158
  marginTop: 11
153
159
  }
154
- }, tour && /* @__PURE__ */ React5.createElement("li", null, /* @__PURE__ */ React5.createElement(TourLink, null)), links.map((link, i) => /* @__PURE__ */ React5.createElement("li", {
160
+ }, tour && /* @__PURE__ */ React4.createElement("li", null, /* @__PURE__ */ React4.createElement(TourLink, null)), links.map((link, i) => /* @__PURE__ */ React4.createElement("li", {
155
161
  key: i
156
- }, /* @__PURE__ */ React5.createElement(Link, {
162
+ }, /* @__PURE__ */ React4.createElement(Link, {
157
163
  href: link
158
164
  }))));
159
165
  })());
160
166
  }
161
167
  function TourLink() {
162
- return /* @__PURE__ */ React5.createElement(React5.Fragment, null, /* @__PURE__ */ React5.createElement(Link, {
168
+ return /* @__PURE__ */ React4.createElement(React4.Fragment, null, /* @__PURE__ */ React4.createElement(Link, {
163
169
  href: "/react-tour",
164
170
  noBreadcrumb: true
165
- }), " or ", /* @__PURE__ */ React5.createElement(Link, {
171
+ }), " or ", /* @__PURE__ */ React4.createElement(Link, {
166
172
  href: "/vue-tour",
167
173
  noBreadcrumb: true
168
174
  }));
169
175
  }
170
176
 
171
177
  // src/components/Note.tsx
172
- import React6 from "react";
178
+ import React5 from "react";
173
179
  function Note({
174
180
  type,
175
181
  icon,
@@ -184,31 +190,31 @@ function Note({
184
190
  icon = ":warning:";
185
191
  }
186
192
  }
187
- return /* @__PURE__ */ React6.createElement("blockquote", {
193
+ return /* @__PURE__ */ React5.createElement("blockquote", {
188
194
  className: type
189
- }, /* @__PURE__ */ React6.createElement("div", {
195
+ }, /* @__PURE__ */ React5.createElement("div", {
190
196
  style: { marginBottom: 20 }
191
- }), icon, " ", children, /* @__PURE__ */ React6.createElement("div", {
197
+ }), icon, " ", children, /* @__PURE__ */ React5.createElement("div", {
192
198
  style: { marginTop: 20 }
193
199
  }));
194
200
  }
195
201
 
196
202
  // src/components/ImportMeta.tsx
197
- import React7 from "react";
203
+ import React6 from "react";
198
204
  function ImportMeta({ prop }) {
199
205
  assert(!prop.startsWith("import"));
200
206
  assert(!prop.startsWith("."));
201
207
  const text = "import.meta." + prop;
202
- return /* @__PURE__ */ React7.createElement("code", null, text);
208
+ return /* @__PURE__ */ React6.createElement("code", null, text);
203
209
  }
204
210
 
205
211
  // src/components/HorizontalLine.tsx
206
- import React8 from "react";
212
+ import React7 from "react";
207
213
  function HorizontalLine({ primary }) {
208
- return /* @__PURE__ */ React8.createElement("div", {
214
+ return /* @__PURE__ */ React7.createElement("div", {
209
215
  className: "header-separator-line " + (primary ? "primary" : ""),
210
216
  style: { textAlign: "center" }
211
- }, /* @__PURE__ */ React8.createElement("hr", {
217
+ }, /* @__PURE__ */ React7.createElement("hr", {
212
218
  style: {
213
219
  display: "inline-block",
214
220
  margin: 0,
@@ -221,7 +227,7 @@ function HorizontalLine({ primary }) {
221
227
  }
222
228
 
223
229
  // src/components/Sponsors.tsx
224
- import React9 from "react";
230
+ import React8 from "react";
225
231
 
226
232
  // src/icons/heart.svg
227
233
  var heart_default = "/assets/heart-OINVKOXO.svg";
@@ -294,9 +300,18 @@ var sponsorsList = [
294
300
  plan: "indie",
295
301
  website: "https://inlang.com/"
296
302
  },
303
+ {
304
+ username: "ser1us"
305
+ },
297
306
  {
298
307
  username: "samuelstroschein"
299
308
  },
309
+ {
310
+ username: "szarapka"
311
+ },
312
+ {
313
+ username: "techniath"
314
+ },
300
315
  {
301
316
  username: "DannyZB"
302
317
  },
@@ -332,9 +347,9 @@ function Sponsors() {
332
347
  const { projectInfo } = pageContext.config;
333
348
  const sponsorsCompany = sponsorsList.filter((sponsor) => !("username" in sponsor));
334
349
  const sponsorsHumanidual = sponsorsList.filter((sponsor) => "username" in sponsor);
335
- return /* @__PURE__ */ React9.createElement("div", {
350
+ return /* @__PURE__ */ React8.createElement("div", {
336
351
  style: { textAlign: "center", marginTop: 19 }
337
- }, /* @__PURE__ */ React9.createElement("a", {
352
+ }, /* @__PURE__ */ React8.createElement("a", {
338
353
  className: "button",
339
354
  href: "https://github.com/sponsors/brillout",
340
355
  style: {
@@ -344,21 +359,21 @@ function Sponsors() {
344
359
  padding: "5px 10px",
345
360
  marginBottom: 10
346
361
  }
347
- }, /* @__PURE__ */ React9.createElement("img", {
362
+ }, /* @__PURE__ */ React8.createElement("img", {
348
363
  src: heart_default,
349
364
  height: 22
350
- }), " ", /* @__PURE__ */ React9.createElement("span", {
365
+ }), " ", /* @__PURE__ */ React8.createElement("span", {
351
366
  style: { marginLeft: 7, fontSize: "1.07em" }
352
- }, "Sponsor")), /* @__PURE__ */ React9.createElement("div", null), /* @__PURE__ */ React9.createElement("div", {
367
+ }, "Sponsor")), /* @__PURE__ */ React8.createElement("div", null), /* @__PURE__ */ React8.createElement("div", {
353
368
  style: { maxWidth: 400, display: "inline-block", marginTop: 12, marginBottom: 12 }
354
- }, projectInfo.projectNameJsx || projectInfo.projectName, " is free and open source, made possible by wonderful sponsors."), /* @__PURE__ */ React9.createElement("div", {
369
+ }, projectInfo.projectNameJsx || projectInfo.projectName, " is free and open source, made possible by wonderful sponsors."), /* @__PURE__ */ React8.createElement("div", {
355
370
  style: { display: "flex", flexWrap: "wrap", justifyContent: "space-evenly", alignItems: "end" }
356
- }, sponsorsCompany.map((sponsor, i) => /* @__PURE__ */ React9.createElement(SponsorDiv, {
371
+ }, sponsorsCompany.map((sponsor, i) => /* @__PURE__ */ React8.createElement(SponsorDiv, {
357
372
  sponsor,
358
373
  key: i
359
- }))), /* @__PURE__ */ React9.createElement("div", {
374
+ }))), /* @__PURE__ */ React8.createElement("div", {
360
375
  style: { display: "flex", flexWrap: "wrap", justifyContent: "center", alignItems: "end", marginTop: 20 }
361
- }, sponsorsHumanidual.map((sponsor, i) => /* @__PURE__ */ React9.createElement(SponsorDiv, {
376
+ }, sponsorsHumanidual.map((sponsor, i) => /* @__PURE__ */ React8.createElement(SponsorDiv, {
362
377
  sponsor,
363
378
  key: i
364
379
  }))));
@@ -387,17 +402,17 @@ function SponsorDiv({ sponsor }) {
387
402
  height = size.height;
388
403
  padding = size.padding;
389
404
  imgAlt = sponsor.companyName;
390
- label = /* @__PURE__ */ React9.createElement(Label, {
405
+ label = /* @__PURE__ */ React8.createElement(Label, {
391
406
  sponsor
392
407
  });
393
408
  }
394
409
  const marginWidth = 5;
395
- return /* @__PURE__ */ React9.createElement("a", {
410
+ return /* @__PURE__ */ React8.createElement("a", {
396
411
  href: website,
397
412
  style: {
398
413
  margin: `10px ${marginWidth}px`
399
414
  }
400
- }, label, /* @__PURE__ */ React9.createElement("div", {
415
+ }, label, /* @__PURE__ */ React8.createElement("div", {
401
416
  style: {
402
417
  backgroundColor,
403
418
  borderRadius: 7,
@@ -410,7 +425,7 @@ function SponsorDiv({ sponsor }) {
410
425
  flexDirection: "column",
411
426
  justifyContent: "center"
412
427
  }
413
- }, /* @__PURE__ */ React9.createElement("img", {
428
+ }, /* @__PURE__ */ React8.createElement("img", {
414
429
  style: { width: `calc(100% - ${padding}px)`, height: height - padding, zIndex: 2, objectFit: "contain" },
415
430
  src: imgSrc,
416
431
  alt: imgAlt
@@ -421,7 +436,7 @@ function Label({ sponsor }) {
421
436
  const labelBg = getLabelBg(sponsor);
422
437
  const labelIcon = getLabelIcon(sponsor);
423
438
  const labelText = getLabelText(sponsor);
424
- return /* @__PURE__ */ React9.createElement("div", {
439
+ return /* @__PURE__ */ React8.createElement("div", {
425
440
  style: {
426
441
  top: 0,
427
442
  display: "flex",
@@ -434,20 +449,20 @@ function Label({ sponsor }) {
434
449
  }
435
450
  function getLabelBg(sponsor) {
436
451
  const height = sponsor.plan === "platinum" ? 32 : 24;
437
- return /* @__PURE__ */ React9.createElement("img", {
452
+ return /* @__PURE__ */ React8.createElement("img", {
438
453
  src: label_default,
439
454
  style: { height, position: "absolute", bottom: 0, zIndex: -1 }
440
455
  });
441
456
  }
442
457
  function getLabelText(sponsor) {
443
458
  if (sponsor.plan === "platinum") {
444
- return /* @__PURE__ */ React9.createElement(React9.Fragment, null);
459
+ return /* @__PURE__ */ React8.createElement(React8.Fragment, null);
445
460
  }
446
461
  let letterSpacing = void 0;
447
462
  if (["bronze", "silver", "gold", "indie"].includes(sponsor.plan)) {
448
463
  letterSpacing = 1;
449
464
  }
450
- return /* @__PURE__ */ React9.createElement(React9.Fragment, null, " ", /* @__PURE__ */ React9.createElement("span", {
465
+ return /* @__PURE__ */ React8.createElement(React8.Fragment, null, " ", /* @__PURE__ */ React8.createElement("span", {
451
466
  style: {
452
467
  zIndex: 1,
453
468
  fontSize: "0.82em",
@@ -462,12 +477,12 @@ function getLabelText(sponsor) {
462
477
  function getLabelIcon(sponsor) {
463
478
  let medalSrc;
464
479
  if (sponsor.plan === "platinum") {
465
- return /* @__PURE__ */ React9.createElement(Emoji, {
480
+ return /* @__PURE__ */ React8.createElement(Emoji, {
466
481
  name: "trophy",
467
482
  style: { fontSize: "1.3em" }
468
483
  });
469
484
  } else if (sponsor.plan === "indie") {
470
- return /* @__PURE__ */ React9.createElement(Emoji, {
485
+ return /* @__PURE__ */ React8.createElement(Emoji, {
471
486
  name: "ribbon",
472
487
  style: { fontSize: "0.9em" }
473
488
  });
@@ -480,7 +495,7 @@ function getLabelIcon(sponsor) {
480
495
  } else {
481
496
  assert(false);
482
497
  }
483
- return /* @__PURE__ */ React9.createElement("img", {
498
+ return /* @__PURE__ */ React8.createElement("img", {
484
499
  src: medalSrc,
485
500
  style: { height: 15, zIndex: 1, marginRight: 5 }
486
501
  });
@@ -508,7 +523,7 @@ function capitalizeFirstLetter(word) {
508
523
  }
509
524
 
510
525
  // src/components/CodeBlock.tsx
511
- import React10 from "react";
526
+ import React9 from "react";
512
527
  function CodeBlock({ children, lineBreak }) {
513
528
  assert(lineBreak, "`lineBreak: true` is currently the only use case for <CodeBlock>");
514
529
  const style = {};
@@ -520,13 +535,12 @@ function CodeBlock({ children, lineBreak }) {
520
535
  paddingRight: "16px !important"
521
536
  });
522
537
  }
523
- return /* @__PURE__ */ React10.createElement("pre", null, /* @__PURE__ */ React10.createElement("code", {
538
+ return /* @__PURE__ */ React9.createElement("pre", null, /* @__PURE__ */ React9.createElement("code", {
524
539
  style
525
540
  }, children));
526
541
  }
527
542
  export {
528
543
  CodeBlock,
529
- DocLink,
530
544
  Emoji,
531
545
  FeatureList,
532
546
  HorizontalLine,
@@ -22,7 +22,7 @@ import {
22
22
  // src/renderer/_default.page.server.tsx
23
23
  import ReactDOMServer from "react-dom/server";
24
24
  import React7 from "react";
25
- import { escapeInject as escapeInject2, dangerouslySkipEscape } from "vite-plugin-ssr";
25
+ import { escapeInject as escapeInject2, dangerouslySkipEscape as dangerouslySkipEscape2 } from "vite-plugin-ssr";
26
26
 
27
27
  // src/PageLayout.tsx
28
28
  import React6 from "react";
@@ -428,11 +428,11 @@ function getConfig() {
428
428
  function resolvePageContext(pageContext) {
429
429
  const config = getConfig();
430
430
  const { headings, headingsWithoutLink } = getHeadings(config);
431
- const activeHeading = findActiveHeading(headings, headingsWithoutLink, pageContext);
432
- const headingsWithSubHeadings = getHeadingsWithSubHeadings(headings, pageContext, activeHeading);
431
+ const { activeHeading, activeNavigationHeading } = findHeading(headings, headingsWithoutLink, pageContext);
432
+ const headingsWithSubHeadings = getHeadingsWithSubHeadings(headings, pageContext, activeNavigationHeading);
433
433
  const { title, isLandingPage, pageTitle, isDetachedPage } = getMetaData(
434
434
  headingsWithoutLink,
435
- activeHeading,
435
+ activeNavigationHeading,
436
436
  pageContext,
437
437
  config
438
438
  );
@@ -449,6 +449,7 @@ function resolvePageContext(pageContext) {
449
449
  tagline,
450
450
  algolia
451
451
  },
452
+ activeHeading,
452
453
  headings,
453
454
  headingsWithSubHeadings,
454
455
  isLandingPage,
@@ -458,14 +459,14 @@ function resolvePageContext(pageContext) {
458
459
  });
459
460
  return pageContextResolved;
460
461
  }
461
- function getMetaData(headingsWithoutLink, activeHeading, pageContext, config) {
462
+ function getMetaData(headingsWithoutLink, activeNavigationHeading, pageContext, config) {
462
463
  const url = pageContext.urlOriginal;
463
464
  let title;
464
465
  let pageTitle;
465
466
  let isDetachedPage;
466
- if (activeHeading) {
467
- title = activeHeading.titleDocument || jsxToTextContent(activeHeading.title);
468
- pageTitle = activeHeading.title;
467
+ if (activeNavigationHeading) {
468
+ title = activeNavigationHeading.titleDocument || jsxToTextContent(activeNavigationHeading.title);
469
+ pageTitle = activeNavigationHeading.title;
469
470
  isDetachedPage = false;
470
471
  } else {
471
472
  pageTitle = headingsWithoutLink.find((h) => h.url === url).title;
@@ -481,29 +482,34 @@ function getMetaData(headingsWithoutLink, activeHeading, pageContext, config) {
481
482
  }
482
483
  return { title, isLandingPage, pageTitle, isDetachedPage };
483
484
  }
484
- function findActiveHeading(headings, headingsWithoutLink, pageContext) {
485
+ function findHeading(headings, headingsWithoutLink, pageContext) {
486
+ let activeNavigationHeading = null;
485
487
  let activeHeading = null;
486
488
  assert(pageContext.urlOriginal);
487
489
  const pageUrl = pageContext.urlOriginal;
488
490
  headings.forEach((heading) => {
489
491
  if (heading.url === pageUrl) {
492
+ activeNavigationHeading = heading;
490
493
  activeHeading = heading;
491
494
  assert(heading.level === 2, { pageUrl, heading });
492
495
  }
493
496
  });
497
+ if (!activeHeading) {
498
+ activeHeading = headingsWithoutLink.find(({ url }) => pageUrl === url) ?? null;
499
+ }
494
500
  const debugInfo = {
495
501
  msg: "Heading not found for url: " + pageUrl,
496
502
  urls: headings.map((h) => h.url),
497
503
  url: pageUrl
498
504
  };
499
- assert(activeHeading || headingsWithoutLink.find(({ url }) => pageUrl === url), debugInfo);
500
- return activeHeading;
505
+ assert(activeHeading, debugInfo);
506
+ return { activeHeading, activeNavigationHeading };
501
507
  }
502
- function getHeadingsWithSubHeadings(headings, pageContext, activeHeading) {
508
+ function getHeadingsWithSubHeadings(headings, pageContext, activeNavigationHeading) {
503
509
  const headingsWithSubHeadings = headings.slice();
504
- if (activeHeading === null)
510
+ if (activeNavigationHeading === null)
505
511
  return headingsWithSubHeadings;
506
- const activeHeadingIdx = headingsWithSubHeadings.indexOf(activeHeading);
512
+ const activeHeadingIdx = headingsWithSubHeadings.indexOf(activeNavigationHeading);
507
513
  assert(activeHeadingIdx >= 0);
508
514
  const pageHeadings = pageContext.exports.headings || [];
509
515
  pageHeadings.forEach((pageHeading, i) => {
@@ -517,15 +523,15 @@ function getHeadingsWithSubHeadings(headings, pageContext, activeHeading) {
517
523
  const heading = {
518
524
  url,
519
525
  title,
520
- parentHeadings: [activeHeading, ...activeHeading.parentHeadings],
526
+ parentHeadings: [activeNavigationHeading, ...activeNavigationHeading.parentHeadings],
521
527
  titleInNav: title,
522
528
  level: 3
523
529
  };
524
530
  headingsWithSubHeadings.splice(activeHeadingIdx + 1 + i, 0, heading);
525
531
  }
526
532
  });
527
- if (activeHeading == null ? void 0 : activeHeading.sectionTitles) {
528
- activeHeading.sectionTitles.forEach((sectionTitle) => {
533
+ if (activeNavigationHeading == null ? void 0 : activeNavigationHeading.sectionTitles) {
534
+ activeNavigationHeading.sectionTitles.forEach((sectionTitle) => {
529
535
  const pageHeadingTitles = pageHeadings.map((h) => h.title);
530
536
  assert(pageHeadingTitles.includes(sectionTitle), { pageHeadingTitles, sectionTitle });
531
537
  });
@@ -534,7 +540,7 @@ function getHeadingsWithSubHeadings(headings, pageContext, activeHeading) {
534
540
  }
535
541
 
536
542
  // src/algolia/DocSearch.ts
537
- import { escapeInject } from "vite-plugin-ssr";
543
+ import { dangerouslySkipEscape, escapeInject } from "vite-plugin-ssr";
538
544
  function getDocSearchCSS(pageContext) {
539
545
  const docSearchCSS = !pageContext.meta.algolia ? "" : escapeInject`
540
546
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@docsearch/css@alpha" />
@@ -543,13 +549,20 @@ function getDocSearchCSS(pageContext) {
543
549
  }
544
550
  var _a;
545
551
  function getDocSearchJS(pageContext) {
546
- const docSearchJS = !pageContext.meta.algolia ? "" : escapeInject(_a || (_a = __template([`
547
- <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@docsearch/js@alpha"><\/script>
548
- <script type="text/javascript">
549
- docsearch({
550
- appId: '`, "',\n apiKey: '", "',\n indexName: '", "',\n container: '#docsearch-desktop',\n })\n docsearch({\n appId: '", "',\n apiKey: '", "',\n indexName: '", "',\n container: '#docsearch-mobile',\n })\n <\/script>\n "])), pageContext.meta.algolia.appId, pageContext.meta.algolia.apiKey, pageContext.meta.algolia.indexName, pageContext.meta.algolia.appId, pageContext.meta.algolia.apiKey, pageContext.meta.algolia.indexName);
552
+ const docSearchJS = !pageContext.meta.algolia ? "" : escapeInject(_a || (_a = __template(['\n <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@docsearch/js@alpha"><\/script>\n <script type="text/javascript">\n const transformData = ', ";\n docsearch({\n appId: '", "',\n apiKey: '", "',\n indexName: '", "',\n container: '#docsearch-desktop',\n transformData\n });\n docsearch({\n appId: '", "',\n apiKey: '", "',\n indexName: '", "',\n container: '#docsearch-mobile',\n transformData\n });\n <\/script>\n "])), dangerouslySkipEscape(getTransformData()), pageContext.meta.algolia.appId, pageContext.meta.algolia.apiKey, pageContext.meta.algolia.indexName, pageContext.meta.algolia.appId, pageContext.meta.algolia.apiKey, pageContext.meta.algolia.indexName);
551
553
  return docSearchJS;
552
554
  }
555
+ function getTransformData() {
556
+ return `function(hits) {
557
+ hits.map(hit => {
558
+ if (hit.anchor === 'page-content') {
559
+ hit.url = hit.url.replace('#'+ hit.anchor, '');
560
+ hit.anchor = null;
561
+ }
562
+ });
563
+ return hits;
564
+ }`;
565
+ }
553
566
 
554
567
  // src/parseEmojis.ts
555
568
  import twemoji from "twemoji";
@@ -582,7 +595,7 @@ async function render(pageContextOriginal) {
582
595
  const page = /* @__PURE__ */ React7.createElement(PageLayout, {
583
596
  pageContext: pageContextResolved
584
597
  }, /* @__PURE__ */ React7.createElement(Page, null));
585
- const descriptionTag = pageContextResolved.isLandingPage ? dangerouslySkipEscape(`<meta name="description" content="${pageContextResolved.meta.tagline}" />`) : "";
598
+ const descriptionTag = pageContextResolved.isLandingPage ? dangerouslySkipEscape2(`<meta name="description" content="${pageContextResolved.meta.tagline}" />`) : "";
586
599
  const docSearchJS = getDocSearchJS(pageContextResolved);
587
600
  const docSearchCSS = getDocSearchCSS(pageContextResolved);
588
601
  let pageHtml = ReactDOMServer.renderToString(page);
@@ -599,7 +612,7 @@ async function render(pageContextOriginal) {
599
612
  ${getOpenGraphTags(pageContextOriginal.urlPathname, pageContextResolved.meta)}
600
613
  </head>
601
614
  <body>
602
- <div id="page-view">${dangerouslySkipEscape(pageHtml)}</div>
615
+ <div id="page-view">${dangerouslySkipEscape2(pageHtml)}</div>
603
616
  ${docSearchJS}
604
617
  </body>
605
618
  </html>`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brillout/docpress",
3
- "version": "0.3.7",
3
+ "version": "0.3.9",
4
4
  "exports": {
5
5
  "./renderer/_default.page.server.js": "./dist/renderer/_default.page.server.js",
6
6
  "./renderer/_default.page.client.js": "./dist/renderer/_default.page.client.js",