@brillout/docpress 0.3.8 → 0.3.10

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.
@@ -0,0 +1,7 @@
1
+ <svg width="146.99mm" height="41.534mm" version="1.1" viewBox="0 0 146.99 41.534" xmlns="http://www.w3.org/2000/svg">
2
+ <g transform="matrix(.26458 0 0 .26458 0 .0026458)">
3
+ <path d="m156.62 78.65c0-12.01-8.81-22.1-20.27-24.12 6.68-9.55 5.74-22.49-2.84-31.08-8.27-8.57-21.41-9.52-31.02-2.88-1.89-11.62-12.05-20.58-24.17-20.58s-22.1 8.81-24.12 20.27c-9.55-6.68-22.49-5.74-31.08 2.84-8.71 8.71-9.56 22.19-2.31 31.33-11.73 1.81-20.81 12.02-20.81 24.22s8.83 21.91 20.32 24.05c-6.73 9.56-5.81 22.54 2.79 31.15 8.6 8.3 21.58 9.18 31.14 3.19 2.16 11.3 12.16 19.93 24.05 19.93s22.2-9.17 24.15-20.78c9.39 6.86 22.74 5.98 31.39-2.67 8.51-8.51 9.51-21.3 3.03-30.83 11.21-2.23 19.74-12.19 19.74-24.02z" fill="#7532a8"/>
4
+ <path class="logo_svg__cls-1" d="m61.33 72.59c0.2-2.08 2.06-3.61 4.15-3.61h3.12c1.67 0 2.7-1.88 1.75-3.25-2.01-2.91-5.38-4.8-9.2-4.74-6.07 0.09-10.84 5.29-10.84 11.36v12.27c0 6.06 4.74 11.25 10.79 11.36s11.21-4.85 11.21-11v-3.96c0-2.23-1.81-4.04-4.04-4.04h-2.96c-2.34 0-4.21-2.01-3.98-4.39zm34 0c0.2-2.08 2.06-3.61 4.15-3.61h3.12c1.67 0 2.7-1.88 1.75-3.25-2.01-2.91-5.38-4.8-9.2-4.74-6.07 0.09-10.84 5.29-10.84 11.36v12.27c0 6.06 4.74 11.25 10.79 11.36s11.21-4.85 11.21-11v-3.96c0-2.23-1.81-4.04-4.04-4.04h-2.96c-2.34 0-4.21-2.01-3.98-4.39z" fill="#fff"/>
5
+ </g>
6
+ <path d="m53.195 30.179c-2.1855-2.0944-3.2782-5.0387-3.2782-8.8531 0-2.6003 0.51601-4.897 1.548-6.8801 1.032-1.9932 2.4991-3.5311 4.3911-4.6036 1.892-1.0725 4.0775-1.629 6.5564-1.629 2.0135 0 3.9561 0.36424 5.8279 1.0927l-0.98143 4.6947c-1.6492-0.74872-3.2579-1.1332-4.806-1.1332-2.2057 0-3.9561 0.71837-5.241 2.1652-1.285 1.4469-1.9325 3.3692-1.9325 5.7773 0 2.408 0.6779 4.3608 2.0438 5.7166 1.3558 1.3558 3.2377 2.0438 5.6458 2.0438 1.5784 0 3.1062-0.25296 4.5935-0.76895l0.79931 4.4822c-1.7706 0.6779-3.7841 1.0219-6.0505 1.0219-3.8853 0-6.9206-1.0421-9.1061-3.1365zm19.264-21.602c0.72848-0.02027 2.0843-0.04046 4.0775-0.04046s3.3895 0.0099 4.118 0.04046c2.7723 0.10118 4.8363 0.76895 6.1921 2.0236 1.3558 1.2546 2.0438 2.9342 2.0438 5.0488 0 1.801-0.4553 3.3187-1.3659 4.5733-0.9106 1.2546-2.1753 2.0742-3.8043 2.4586 0.50589 0.41483 1.032 0.98143 1.5683 1.6897 0.53625 0.71837 1.2749 1.8313 2.2259 3.3288 0.99155 1.5784 2.0033 3.2883 3.0252 5.1399h-6.1213l-4.118-7.6491c-0.43507-0.79931-0.82966-1.3052-1.1838-1.5076-0.35415-0.20237-0.88026-0.31365-1.5885-0.31365v9.4703h-5.0589v-24.263zm7.3253 10.745c1.2344 0 2.2158-0.31365 2.9342-0.95108 0.71837-0.6273 1.0725-1.4772 1.0725-2.5497 0-0.97131-0.31365-1.7099-0.95108-2.2259-0.6273-0.50589-1.5581-0.76896-2.7723-0.76896h-2.5497v6.4855h2.2563zm13.224-10.745h14.752v4.5935h-9.5411v4.8464h7.902v4.4417h-7.902v5.7874h9.5411v4.5935h-14.752zm19.305 0c0.70825-0.02027 2.0438-0.04046 4.0067-0.04046 1.9629 0 3.3389 0.0099 4.0471 0.04046 2.4991 0.05059 4.4721 0.71837 5.8987 2.0033 1.4367 1.285 2.145 3.0758 2.145 5.3523 0 1.629-0.36424 3.0657-1.0927 4.3203-0.72849 1.2546-1.7504 2.2158-3.0758 2.8937-1.3254 0.67789-2.8229 1.0219-4.5024 1.0219h-2.3676v8.671h-5.0589zm7.214 11.292c1.1838 0 2.1146-0.34401 2.7824-1.0219 0.66778-0.67789 1.0017-1.5986 1.0017-2.7723 0-2.1349-1.1737-3.2074-3.5311-3.2074h-2.408v6.9914h2.145zm12.708-11.292h14.752v4.5935h-9.5411v4.8464h7.902v4.4417h-7.902v5.7874h9.5411v4.5935h-14.752z" fill="currentColor" stroke-width="1.0118"/>
7
+ </svg>
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);
65
+ }
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;
55
75
  }
56
- const heading = findHeading(hrefWithoutHash, pageContext);
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";
@@ -238,8 +244,8 @@ var medalBronze_default = "/assets/medalBronze-CO4CTUR4.svg";
238
244
  // src/components/Sponsors/label.svg
239
245
  var label_default = "/assets/label-MP75CTIA.svg";
240
246
 
241
- // src/components/Sponsors/companyLogos/ccoli.svg
242
- var ccoli_default = "/assets/ccoli-CHW3TQKS.svg";
247
+ // src/components/Sponsors/companyLogos/crepe.svg
248
+ var crepe_default = "/assets/crepe-H7AW7P3A.svg";
243
249
 
244
250
  // src/components/Sponsors/companyLogos/contra.svg
245
251
  var contra_default = "/assets/contra-WLZBOPBV.svg";
@@ -271,10 +277,10 @@ var sponsorsList = [
271
277
  website: "https://contra.com"
272
278
  },
273
279
  {
274
- companyName: "ccoli",
275
- companyLogo: ccoli_default,
280
+ companyName: "CREPE",
281
+ companyLogo: crepe_default,
276
282
  plan: "silver",
277
- website: "https://ccoli.co"
283
+ website: "https://crepe.cm"
278
284
  },
279
285
  {
280
286
  companyName: "My Favorite Quilt Store",
@@ -341,9 +347,9 @@ function Sponsors() {
341
347
  const { projectInfo } = pageContext.config;
342
348
  const sponsorsCompany = sponsorsList.filter((sponsor) => !("username" in sponsor));
343
349
  const sponsorsHumanidual = sponsorsList.filter((sponsor) => "username" in sponsor);
344
- return /* @__PURE__ */ React9.createElement("div", {
350
+ return /* @__PURE__ */ React8.createElement("div", {
345
351
  style: { textAlign: "center", marginTop: 19 }
346
- }, /* @__PURE__ */ React9.createElement("a", {
352
+ }, /* @__PURE__ */ React8.createElement("a", {
347
353
  className: "button",
348
354
  href: "https://github.com/sponsors/brillout",
349
355
  style: {
@@ -353,21 +359,21 @@ function Sponsors() {
353
359
  padding: "5px 10px",
354
360
  marginBottom: 10
355
361
  }
356
- }, /* @__PURE__ */ React9.createElement("img", {
362
+ }, /* @__PURE__ */ React8.createElement("img", {
357
363
  src: heart_default,
358
364
  height: 22
359
- }), " ", /* @__PURE__ */ React9.createElement("span", {
365
+ }), " ", /* @__PURE__ */ React8.createElement("span", {
360
366
  style: { marginLeft: 7, fontSize: "1.07em" }
361
- }, "Sponsor")), /* @__PURE__ */ React9.createElement("div", null), /* @__PURE__ */ React9.createElement("div", {
367
+ }, "Sponsor")), /* @__PURE__ */ React8.createElement("div", null), /* @__PURE__ */ React8.createElement("div", {
362
368
  style: { maxWidth: 400, display: "inline-block", marginTop: 12, marginBottom: 12 }
363
- }, 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", {
364
370
  style: { display: "flex", flexWrap: "wrap", justifyContent: "space-evenly", alignItems: "end" }
365
- }, sponsorsCompany.map((sponsor, i) => /* @__PURE__ */ React9.createElement(SponsorDiv, {
371
+ }, sponsorsCompany.map((sponsor, i) => /* @__PURE__ */ React8.createElement(SponsorDiv, {
366
372
  sponsor,
367
373
  key: i
368
- }))), /* @__PURE__ */ React9.createElement("div", {
374
+ }))), /* @__PURE__ */ React8.createElement("div", {
369
375
  style: { display: "flex", flexWrap: "wrap", justifyContent: "center", alignItems: "end", marginTop: 20 }
370
- }, sponsorsHumanidual.map((sponsor, i) => /* @__PURE__ */ React9.createElement(SponsorDiv, {
376
+ }, sponsorsHumanidual.map((sponsor, i) => /* @__PURE__ */ React8.createElement(SponsorDiv, {
371
377
  sponsor,
372
378
  key: i
373
379
  }))));
@@ -396,17 +402,17 @@ function SponsorDiv({ sponsor }) {
396
402
  height = size.height;
397
403
  padding = size.padding;
398
404
  imgAlt = sponsor.companyName;
399
- label = /* @__PURE__ */ React9.createElement(Label, {
405
+ label = /* @__PURE__ */ React8.createElement(Label, {
400
406
  sponsor
401
407
  });
402
408
  }
403
409
  const marginWidth = 5;
404
- return /* @__PURE__ */ React9.createElement("a", {
410
+ return /* @__PURE__ */ React8.createElement("a", {
405
411
  href: website,
406
412
  style: {
407
413
  margin: `10px ${marginWidth}px`
408
414
  }
409
- }, label, /* @__PURE__ */ React9.createElement("div", {
415
+ }, label, /* @__PURE__ */ React8.createElement("div", {
410
416
  style: {
411
417
  backgroundColor,
412
418
  borderRadius: 7,
@@ -419,7 +425,7 @@ function SponsorDiv({ sponsor }) {
419
425
  flexDirection: "column",
420
426
  justifyContent: "center"
421
427
  }
422
- }, /* @__PURE__ */ React9.createElement("img", {
428
+ }, /* @__PURE__ */ React8.createElement("img", {
423
429
  style: { width: `calc(100% - ${padding}px)`, height: height - padding, zIndex: 2, objectFit: "contain" },
424
430
  src: imgSrc,
425
431
  alt: imgAlt
@@ -430,7 +436,7 @@ function Label({ sponsor }) {
430
436
  const labelBg = getLabelBg(sponsor);
431
437
  const labelIcon = getLabelIcon(sponsor);
432
438
  const labelText = getLabelText(sponsor);
433
- return /* @__PURE__ */ React9.createElement("div", {
439
+ return /* @__PURE__ */ React8.createElement("div", {
434
440
  style: {
435
441
  top: 0,
436
442
  display: "flex",
@@ -443,20 +449,20 @@ function Label({ sponsor }) {
443
449
  }
444
450
  function getLabelBg(sponsor) {
445
451
  const height = sponsor.plan === "platinum" ? 32 : 24;
446
- return /* @__PURE__ */ React9.createElement("img", {
452
+ return /* @__PURE__ */ React8.createElement("img", {
447
453
  src: label_default,
448
454
  style: { height, position: "absolute", bottom: 0, zIndex: -1 }
449
455
  });
450
456
  }
451
457
  function getLabelText(sponsor) {
452
458
  if (sponsor.plan === "platinum") {
453
- return /* @__PURE__ */ React9.createElement(React9.Fragment, null);
459
+ return /* @__PURE__ */ React8.createElement(React8.Fragment, null);
454
460
  }
455
461
  let letterSpacing = void 0;
456
462
  if (["bronze", "silver", "gold", "indie"].includes(sponsor.plan)) {
457
463
  letterSpacing = 1;
458
464
  }
459
- return /* @__PURE__ */ React9.createElement(React9.Fragment, null, " ", /* @__PURE__ */ React9.createElement("span", {
465
+ return /* @__PURE__ */ React8.createElement(React8.Fragment, null, " ", /* @__PURE__ */ React8.createElement("span", {
460
466
  style: {
461
467
  zIndex: 1,
462
468
  fontSize: "0.82em",
@@ -471,12 +477,12 @@ function getLabelText(sponsor) {
471
477
  function getLabelIcon(sponsor) {
472
478
  let medalSrc;
473
479
  if (sponsor.plan === "platinum") {
474
- return /* @__PURE__ */ React9.createElement(Emoji, {
480
+ return /* @__PURE__ */ React8.createElement(Emoji, {
475
481
  name: "trophy",
476
482
  style: { fontSize: "1.3em" }
477
483
  });
478
484
  } else if (sponsor.plan === "indie") {
479
- return /* @__PURE__ */ React9.createElement(Emoji, {
485
+ return /* @__PURE__ */ React8.createElement(Emoji, {
480
486
  name: "ribbon",
481
487
  style: { fontSize: "0.9em" }
482
488
  });
@@ -489,7 +495,7 @@ function getLabelIcon(sponsor) {
489
495
  } else {
490
496
  assert(false);
491
497
  }
492
- return /* @__PURE__ */ React9.createElement("img", {
498
+ return /* @__PURE__ */ React8.createElement("img", {
493
499
  src: medalSrc,
494
500
  style: { height: 15, zIndex: 1, marginRight: 5 }
495
501
  });
@@ -517,7 +523,7 @@ function capitalizeFirstLetter(word) {
517
523
  }
518
524
 
519
525
  // src/components/CodeBlock.tsx
520
- import React10 from "react";
526
+ import React9 from "react";
521
527
  function CodeBlock({ children, lineBreak }) {
522
528
  assert(lineBreak, "`lineBreak: true` is currently the only use case for <CodeBlock>");
523
529
  const style = {};
@@ -529,13 +535,12 @@ function CodeBlock({ children, lineBreak }) {
529
535
  paddingRight: "16px !important"
530
536
  });
531
537
  }
532
- return /* @__PURE__ */ React10.createElement("pre", null, /* @__PURE__ */ React10.createElement("code", {
538
+ return /* @__PURE__ */ React9.createElement("pre", null, /* @__PURE__ */ React9.createElement("code", {
533
539
  style
534
540
  }, children));
535
541
  }
536
542
  export {
537
543
  CodeBlock,
538
- DocLink,
539
544
  Emoji,
540
545
  FeatureList,
541
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,19 +549,23 @@ function getDocSearchCSS(pageContext) {
543
549
  }
544
550
  var _a;
545
551
  function getDocSearchJS(pageContext) {
546
- 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 "])), 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);
552
+ const { algolia } = pageContext.meta;
553
+ const docSearchJS = !algolia ? "" : escapeInject(_a || (_a = __template([`
554
+ <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@docsearch/js@alpha"><\/script>
555
+ <script type="text/javascript">
556
+ const appId = '`, "';\n const apiKey = '", "';\n const indexName = '", "';\n const transformData = ", ";\n docsearch({\n container: '#docsearch-desktop',\n appId, apiKey, indexName, transformData\n });\n docsearch({\n container: '#docsearch-mobile',\n appId, apiKey, indexName, transformData\n });\n <\/script>\n "])), algolia.appId, algolia.apiKey, algolia.indexName, dangerouslySkipEscape(getTransformData()));
547
557
  return docSearchJS;
548
558
  }
549
559
  function getTransformData() {
550
560
  return `function(hits) {
551
- hits.map(hit => {
552
- if (hit.anchor === 'page-content') {
553
- hit.url = hit.url.replace('#'+ hit.anchor, '');
554
- hit.anchor = null;
555
- }
556
- });
557
- return hits;
558
- }`;
561
+ hits.map(hit => {
562
+ if (hit.anchor === 'page-content') {
563
+ hit.url = hit.url.replace('#'+ hit.anchor, '');
564
+ hit.anchor = null;
565
+ }
566
+ });
567
+ return hits;
568
+ }`;
559
569
  }
560
570
 
561
571
  // src/parseEmojis.ts
@@ -589,7 +599,7 @@ async function render(pageContextOriginal) {
589
599
  const page = /* @__PURE__ */ React7.createElement(PageLayout, {
590
600
  pageContext: pageContextResolved
591
601
  }, /* @__PURE__ */ React7.createElement(Page, null));
592
- const descriptionTag = pageContextResolved.isLandingPage ? dangerouslySkipEscape(`<meta name="description" content="${pageContextResolved.meta.tagline}" />`) : "";
602
+ const descriptionTag = pageContextResolved.isLandingPage ? dangerouslySkipEscape2(`<meta name="description" content="${pageContextResolved.meta.tagline}" />`) : "";
593
603
  const docSearchJS = getDocSearchJS(pageContextResolved);
594
604
  const docSearchCSS = getDocSearchCSS(pageContextResolved);
595
605
  let pageHtml = ReactDOMServer.renderToString(page);
@@ -606,7 +616,7 @@ async function render(pageContextOriginal) {
606
616
  ${getOpenGraphTags(pageContextOriginal.urlPathname, pageContextResolved.meta)}
607
617
  </head>
608
618
  <body>
609
- <div id="page-view">${dangerouslySkipEscape(pageHtml)}</div>
619
+ <div id="page-view">${dangerouslySkipEscape2(pageHtml)}</div>
610
620
  ${docSearchJS}
611
621
  </body>
612
622
  </html>`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brillout/docpress",
3
- "version": "0.3.8",
3
+ "version": "0.3.10",
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",
@@ -1,9 +0,0 @@
1
- <svg width="148.1mm" height="41.534mm" version="1.1" viewBox="0 0 148.1 41.534" xmlns="http://www.w3.org/2000/svg">
2
- <g transform="translate(-84.28 -127.73)">
3
- <g transform="matrix(.26458 0 0 .26458 84.28 127.74)">
4
- <path d="m156.62 78.65c0-12.01-8.81-22.1-20.27-24.12 6.68-9.55 5.74-22.49-2.84-31.08-8.27-8.57-21.41-9.52-31.02-2.88-1.89-11.62-12.05-20.58-24.17-20.58s-22.1 8.81-24.12 20.27c-9.55-6.68-22.49-5.74-31.08 2.84-8.71 8.71-9.56 22.19-2.31 31.33-11.73 1.81-20.81 12.02-20.81 24.22s8.83 21.91 20.32 24.05c-6.73 9.56-5.81 22.54 2.79 31.15 8.6 8.3 21.58 9.18 31.14 3.19 2.16 11.3 12.16 19.93 24.05 19.93s22.2-9.17 24.15-20.78c9.39 6.86 22.74 5.98 31.39-2.67 8.51-8.51 9.51-21.3 3.03-30.83 11.21-2.23 19.74-12.19 19.74-24.02z" fill="#7532a8"/>
5
- <path class="logo_svg__cls-1" d="m61.33 72.59c0.2-2.08 2.06-3.61 4.15-3.61h3.12c1.67 0 2.7-1.88 1.75-3.25-2.01-2.91-5.38-4.8-9.2-4.74-6.07 0.09-10.84 5.29-10.84 11.36v12.27c0 6.06 4.74 11.25 10.79 11.36s11.21-4.85 11.21-11v-3.96c0-2.23-1.81-4.04-4.04-4.04h-2.96c-2.34 0-4.21-2.01-3.98-4.39zm34 0c0.2-2.08 2.06-3.61 4.15-3.61h3.12c1.67 0 2.7-1.88 1.75-3.25-2.01-2.91-5.38-4.8-9.2-4.74-6.07 0.09-10.84 5.29-10.84 11.36v12.27c0 6.06 4.74 11.25 10.79 11.36s11.21-4.85 11.21-11v-3.96c0-2.23-1.81-4.04-4.04-4.04h-2.96c-2.34 0-4.21-2.01-3.98-4.39z" fill="#fff"/>
6
- </g>
7
- <path d="m171.83 162.67a13.438 13.438 0 0 1-5.2255-0.96573 11.377 11.377 0 0 1-3.9529-2.6961 12.435 12.435 0 0 1-2.5241-3.9317 12.756 12.756 0 0 1 0.63765-10.718 11.536 11.536 0 0 1 4.3392-4.4265q2.8178-1.6616 6.6807-1.6642 3.8629-3e-3 6.6331 1.6828a11.737 11.737 0 0 1 1.8521 1.3917 2.3812 2.3812 0 0 1-0.93398 3.9952l-0.92869 0.28311a2.7702 2.7702 0 0 1-2.7437-0.63765 5.1541 5.1541 0 0 0-1.1192-0.82815 5.6938 5.6938 0 0 0-2.8152-0.70643 5.969 5.969 0 0 0-3.1591 0.87048 6.0299 6.0299 0 0 0-2.249 2.4527 7.8978 7.8978 0 0 0-0.81757 3.6777 7.6174 7.6174 0 0 0 0.83873 3.6327 6.5855 6.5855 0 0 0 2.249 2.495 5.6489 5.6489 0 0 0 3.138 0.91546 5.8579 5.8579 0 0 0 2.0664-0.36513 5.9822 5.9822 0 0 0 1.7489-1.0001c0.10583-0.0847 0.20373-0.17463 0.29633-0.26458a2.6723 2.6723 0 0 1 2.6458-0.635l0.8255 0.26458a2.4633 2.4633 0 0 1 0.98425 4.1513l-0.0318 0.0291a11.499 11.499 0 0 1-3.6724 2.204 13.436 13.436 0 0 1-4.7625 0.79375zm-23.926 0a13.446 13.446 0 0 1-5.2255-0.96573 11.377 11.377 0 0 1-3.9529-2.6961 12.647 12.647 0 0 1-1.8865-14.65 11.544 11.544 0 0 1 4.3418-4.4265q2.8152-1.6616 6.6781-1.6642 3.8629-3e-3 6.6358 1.6828a11.737 11.737 0 0 1 1.8521 1.3917 2.3812 2.3812 0 0 1-0.92075 3.9952l-0.92604 0.28311a2.7755 2.7755 0 0 1-2.7517-0.63765 5.1382 5.1382 0 0 0-1.1166-0.82815 5.7124 5.7124 0 0 0-2.8178-0.70643 5.9769 5.9769 0 0 0-3.1591 0.87048 6.0484 6.0484 0 0 0-2.249 2.4527 7.8978 7.8978 0 0 0-0.81756 3.6777 7.62 7.62 0 0 0 0.84137 3.6327 6.5855 6.5855 0 0 0 2.249 2.495 5.6462 5.6462 0 0 0 3.1353 0.91546 5.8711 5.8711 0 0 0 2.069-0.36513 5.9822 5.9822 0 0 0 1.7489-1.0001c0.10319-0.0847 0.20108-0.17463 0.29633-0.26458a2.667 2.667 0 0 1 2.6458-0.635l0.8255 0.26458a2.4606 2.4606 0 0 1 0.96308 4.1645l-0.0318 0.0291a11.47 11.47 0 0 1-3.6804 2.204 13.425 13.425 0 0 1-4.7466 0.78052zm47.665 0a13.451 13.451 0 0 1-5.2176-0.96573 11.314 11.314 0 0 1-3.9291-2.6723 12.012 12.012 0 0 1-2.4765-3.9105 12.544 12.544 0 0 1-0.86519-4.6276 12.671 12.671 0 0 1 0.86519-4.6752 12.012 12.012 0 0 1 2.4765-3.9105 11.314 11.314 0 0 1 3.9291-2.6723 13.451 13.451 0 0 1 5.2282-0.96838 13.269 13.269 0 0 1 5.2017 0.96838 11.541 11.541 0 0 1 6.3976 6.5828 12.988 12.988 0 0 1 0.84138 4.6752 12.859 12.859 0 0 1-0.84138 4.6276 11.74 11.74 0 0 1-2.4553 3.9105 11.29 11.29 0 0 1-3.9291 2.6723 13.446 13.446 0 0 1-5.2255 0.96573zm-6.2256-12.171a7.8131 7.8131 0 0 0 0.81756 3.6354 6.2706 6.2706 0 0 0 2.2252 2.4738 5.842 5.842 0 0 0 3.175 0.89165 5.6462 5.6462 0 0 0 3.1353-0.91546 6.6146 6.6146 0 0 0 2.249-2.495 7.62 7.62 0 0 0 0.84138-3.6327 7.6544 7.6544 0 0 0-0.84138-3.6116 6.3976 6.3976 0 0 0-2.249-2.495 5.9664 5.9664 0 0 0-6.3182 0.0212 6.4214 6.4214 0 0 0-2.2251 2.495 7.8079 7.8079 0 0 0-0.80963 3.6248zm23.926-21.455a4.7784 4.7784 0 0 1 4.7784 4.7784v20.841q0 1.6431 0.54504 2.2119a1.9791 1.9791 0 0 0 1.5002 0.56885 6.5193 6.5193 0 0 0 1.5002-0.17991h0.0159a1.3229 1.3229 0 0 1 1.614 1.0583l0.36777 2.0823a1.3229 1.3229 0 0 1-0.87312 1.4711 13.097 13.097 0 0 1-1.8071 0.47625 15.634 15.634 0 0 1-2.9528 0.3175q-2.8654 0-4.4318-1.524-1.5663-1.524-1.5663-4.3524v-26.427a1.3229 1.3229 0 0 1 1.3097-1.3229zm13.01 3.0215a3.0215 3.0215 0 0 1 3.0215-3.0215h0.0476a3.0215 3.0215 0 0 1 3.0215 3.0215 3.0215 3.0215 0 0 1-3.0215 3.0215h-0.0476a3.0215 3.0215 0 0 1-3.0215-3.0215zm0 28.84v-21.19a1.3229 1.3229 0 0 1 1.3229-1.3097 4.781 4.781 0 0 1 4.7784 4.7784v17.727a1.3229 1.3229 0 0 1-1.3229 1.3229h-3.466a1.3229 1.3229 0 0 1-1.3123-1.3282z" fill="#101820" stroke-width=".26458"/>
8
- </g>
9
- </svg>