@brillout/docpress 0.13.1 → 0.13.2

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/EditLink.tsx CHANGED
@@ -22,7 +22,8 @@ function EditLink({ className, style }: { className?: string; style: React.CSSPr
22
22
  )
23
23
  const { urlPathname } = pageContext
24
24
  const fsPath = urlPathname === '/' ? '/index/+Page.tsx' : `${urlPathname}/+Page.mdx`
25
- const editLink = getRepoHref(`/docs/pages${fsPath}`, true)
25
+ const docsDir = pageContext.config.docsDir ?? 'docs'
26
+ const editLink = getRepoHref(`/${docsDir}/pages${fsPath}`, true)
26
27
  return (
27
28
  <a href={editLink} className={className} style={{ display: 'flex', alignItems: 'center', ...style }}>
28
29
  {icon} Edit this page
@@ -11,13 +11,13 @@ function isRepoLink(href: string) {
11
11
  )
12
12
  }
13
13
 
14
- function RepoLink({ path, text, editMode }: { path: string; text?: string | React.ReactNode; editMode?: true }) {
14
+ function RepoLink({ path, text }: { path: string; text?: string | React.ReactNode }) {
15
15
  text = text || path
16
- const href = getRepoHref(path, editMode)
16
+ const href = getRepoHref(path)
17
17
  return <a href={href}>{text}</a>
18
18
  }
19
19
 
20
- function getRepoHref(path: string, editMode?: true) {
20
+ function getRepoHref(path: string, editMode = false) {
21
21
  const pageContext = usePageContext()
22
22
  assert(isRepoLink(path), { path })
23
23
  if (!path.startsWith('/')) {
@@ -1,9 +1,8 @@
1
1
  export { RepoLink };
2
2
  export { getRepoHref };
3
3
  import React from 'react';
4
- declare function RepoLink({ path, text, editMode }: {
4
+ declare function RepoLink({ path, text }: {
5
5
  path: string;
6
6
  text?: string | React.ReactNode;
7
- editMode?: true;
8
7
  }): React.JSX.Element;
9
- declare function getRepoHref(path: string, editMode?: true): string;
8
+ declare function getRepoHref(path: string, editMode?: boolean): string;
@@ -9,12 +9,13 @@ function isRepoLink(href) {
9
9
  });
10
10
  }
11
11
  function RepoLink(_a) {
12
- var path = _a.path, text = _a.text, editMode = _a.editMode;
12
+ var path = _a.path, text = _a.text;
13
13
  text = text || path;
14
- var href = getRepoHref(path, editMode);
14
+ var href = getRepoHref(path);
15
15
  return React.createElement("a", { href: href }, text);
16
16
  }
17
17
  function getRepoHref(path, editMode) {
18
+ if (editMode === void 0) { editMode = false; }
18
19
  var pageContext = usePageContext();
19
20
  assert(isRepoLink(path), { path: path });
20
21
  if (!path.startsWith('/')) {
@@ -11,6 +11,7 @@ type Config = {
11
11
  twitterProfile: string;
12
12
  blueskyHandle?: string;
13
13
  };
14
+ docsDir?: string;
14
15
  logoUrl?: string;
15
16
  faviconUrl?: string;
16
17
  algolia: null | {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brillout/docpress",
3
- "version": "0.13.1",
3
+ "version": "0.13.2",
4
4
  "type": "module",
5
5
  "dependencies": {
6
6
  "@brillout/picocolors": "^1.0.10",
package/types/Config.ts CHANGED
@@ -13,6 +13,7 @@ type Config = {
13
13
  twitterProfile: string
14
14
  blueskyHandle?: string
15
15
  }
16
+ docsDir?: string
16
17
  logoUrl?: string
17
18
  faviconUrl?: string
18
19
  algolia: null | {