@brillout/docpress 0.4.6 → 0.4.8

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
@@ -110,9 +110,15 @@ declare function ReadingRecommendation({ tour, links }: {
110
110
  links: string[];
111
111
  }): JSX.Element;
112
112
 
113
+ declare function Warning({ children }: {
114
+ children: JSX.Element;
115
+ }): JSX.Element;
116
+ declare function Construction({ children }: {
117
+ children: JSX.Element;
118
+ }): JSX.Element;
113
119
  declare function Note({ type, icon, children }: {
114
- icon: JSX.Element | string;
115
- type?: 'error' | 'warning';
120
+ icon?: JSX.Element | string;
121
+ type?: 'error' | 'warning' | 'construction';
116
122
  children: JSX.Element;
117
123
  }): JSX.Element;
118
124
 
@@ -148,4 +154,4 @@ declare function CodeBlock({ children, lineBreak }: {
148
154
  lineBreak?: true;
149
155
  }): JSX.Element;
150
156
 
151
- export { CodeBlock, Config, Emoji, EmojiName, HeadingDefinition, HeadingDetachedDefinition, HorizontalLine, ImportMeta, Info, Link, Note, P, ReadingRecommendation, RepoLink, Sponsor, Sponsors, assert, assertUsage, assertWarning, crawlAllFiles, determineSectionTitle, determineSectionUrlHash, filter, isBrowser, isRepoLink, jsxToTextContent, objectAssign };
157
+ export { CodeBlock, Config, Construction, Emoji, EmojiName, HeadingDefinition, HeadingDetachedDefinition, HorizontalLine, ImportMeta, Info, Link, Note, P, ReadingRecommendation, RepoLink, Sponsor, Sponsors, Warning, assert, assertUsage, assertWarning, crawlAllFiles, determineSectionTitle, determineSectionUrlHash, filter, isBrowser, isRepoLink, jsxToTextContent, objectAssign };
package/dist/index.js CHANGED
@@ -61,17 +61,22 @@ function getTitle({
61
61
  assert(hrefWithoutHash || urlHash);
62
62
  }
63
63
  let heading;
64
- let linkIsOnSamePage;
64
+ let linkIsOnSamePage = false;
65
65
  if (hrefWithoutHash) {
66
66
  heading = findHeading(hrefWithoutHash, pageContext);
67
- linkIsOnSamePage = heading.url === pageContext.urlPathname;
67
+ if (heading.url === pageContext.urlPathname) {
68
+ linkIsOnSamePage = true;
69
+ heading = pageContext.activeHeading;
70
+ }
68
71
  } else {
69
72
  assert(urlHash);
70
73
  linkIsOnSamePage = true;
71
74
  heading = pageContext.activeHeading;
72
75
  }
73
76
  assert(heading);
74
- assert(heading === pageContext.activeHeading || !linkIsOnSamePage);
77
+ assert(linkIsOnSamePage === (heading.url === pageContext.urlPathname));
78
+ assert(linkIsOnSamePage === (heading.url === pageContext.activeHeading.url));
79
+ assert(linkIsOnSamePage === (heading === pageContext.activeHeading));
75
80
  const breadcrumbs = [];
76
81
  if (heading.parentHeadings) {
77
82
  breadcrumbs.push(
@@ -175,22 +180,38 @@ function TourLink() {
175
180
 
176
181
  // src/components/Note.tsx
177
182
  import React5 from "react";
183
+ function Warning({ children }) {
184
+ return /* @__PURE__ */ React5.createElement(Note, {
185
+ type: "warning"
186
+ }, children);
187
+ }
188
+ function Construction({ children }) {
189
+ return /* @__PURE__ */ React5.createElement(Note, {
190
+ type: "construction"
191
+ }, children);
192
+ }
178
193
  function Note({
179
194
  type,
180
195
  icon,
181
196
  children
182
197
  }) {
183
- assert(type === void 0 || ["error", "warning"].includes(type));
198
+ let className;
184
199
  if (!icon) {
185
200
  if (type === "error") {
186
201
  icon = ":no_entry:";
202
+ className = "error";
187
203
  }
188
204
  if (type === "warning") {
189
205
  icon = ":warning:";
206
+ className = "warning";
207
+ }
208
+ if (type === "construction") {
209
+ icon = ":construction:";
210
+ className = "warning";
190
211
  }
191
212
  }
192
213
  return /* @__PURE__ */ React5.createElement("blockquote", {
193
- className: type
214
+ className
194
215
  }, /* @__PURE__ */ React5.createElement("div", {
195
216
  style: { marginBottom: 20 }
196
217
  }), icon, " ", children, /* @__PURE__ */ React5.createElement("div", {
@@ -266,6 +287,12 @@ var inlang_default = "/assets/inlang-GFRWND6X.png";
266
287
 
267
288
  // src/components/Sponsors/sponsorsList.ts
268
289
  var individuals = [
290
+ {
291
+ username: "harrytran998"
292
+ },
293
+ {
294
+ username: "royalswe"
295
+ },
269
296
  {
270
297
  username: "alexturpin"
271
298
  },
@@ -636,6 +663,7 @@ function CodeBlock({ children, lineBreak }) {
636
663
  }
637
664
  export {
638
665
  CodeBlock,
666
+ Construction,
639
667
  Emoji,
640
668
  FeatureList,
641
669
  HorizontalLine,
@@ -647,6 +675,7 @@ export {
647
675
  ReadingRecommendation,
648
676
  RepoLink,
649
677
  Sponsors,
678
+ Warning,
650
679
  assert,
651
680
  assertUsage,
652
681
  assertWarning,
@@ -533,11 +533,6 @@ function getPageHeadings(pageContext, currentHeading) {
533
533
  markdownHeadings.forEach((markdownHeading) => {
534
534
  const title = parseTitle(markdownHeading.title);
535
535
  const url = markdownHeading.headingId && "#" + markdownHeading.headingId;
536
- if (markdownHeading.headingLevel === 3) {
537
- console.warn(
538
- "Wrong page heading level `" + markdownHeading.headingLevel + "` (it should be `<h2>`) for sub-heading `" + markdownHeading.title + "` of page `" + pageContext.urlOriginal + "`."
539
- );
540
- }
541
536
  if (markdownHeading.headingLevel === 2) {
542
537
  const heading = {
543
538
  url,
@@ -591,7 +586,8 @@ import twemoji from "twemoji";
591
586
  var emojiList = {
592
587
  ":no_entry:": 9940,
593
588
  ":warning:": 9888,
594
- ":trophy:": 127942
589
+ ":trophy:": 127942,
590
+ ":construction:": 128679
595
591
  };
596
592
  function parseEmojis(html) {
597
593
  Object.entries(emojiList).forEach(([shortcode, codepoint]) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brillout/docpress",
3
- "version": "0.4.6",
3
+ "version": "0.4.8",
4
4
  "scripts": {
5
5
  "// Check types while developing": "",
6
6
  "types": "tsc --noEmit --watch",