Skip to content

Commit 5cd50e7

Browse files
feat: use fumadocs for website (#1654)
Co-authored-by: Matthew Lipski <[email protected]> Co-authored-by: Matthew Lipski <[email protected]>
1 parent 661d050 commit 5cd50e7

File tree

469 files changed

+10607
-8738
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

469 files changed

+10607
-8738
lines changed

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,8 @@
1818
"search.defaultViewMode": "tree",
1919
"[typescript]": {
2020
"editor.defaultFormatter": "esbenp.prettier-vscode"
21+
},
22+
"[mdx]": {
23+
"editor.defaultFormatter": "esbenp.prettier-vscode"
2124
}
2225
}

docs/.eslintrc.json

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
{
2-
"extends": "next/core-web-vitals",
3-
"parser": "@typescript-eslint/parser",
4-
"plugins": ["@typescript-eslint"],
52
"rules": {
6-
"import/extensions": 0,
7-
"@next/next/no-img-element": "off"
8-
},
9-
"root": true
3+
"import/extensions": 0
4+
}
105
}

docs/.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ yarn-error.log*
3535
*.tsbuildinfo
3636
next-env.d.ts
3737

38+
# database
39+
*.db
40+
3841
# Sentry Config File
3942
.env.sentry-build-plugin
40-
*.db
43+
/content/examples/*/*
44+
/components/example/generated/
45+
/.source/

docs/DEVELOPMENT.md

Lines changed: 0 additions & 99 deletions
This file was deleted.

docs/README.md

Lines changed: 94 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,105 @@
1-
# BlockNote Docs
1+
# Website Development
22

3-
This is the code for the [BlockNote documentation website](https://www.blocknotejs.org).
3+
This is the code for the [BlockNote documentation website](https://www.blocknotejs.org). If you're looking to work on BlockNote itself, check the [`packages`](/packages/) folder.
44

5-
If you're looking to work on BlockNote itself, check the [`packages`](/packages/) folder.
5+
To get started with development of the website, you can follow these steps:
66

7-
## Getting Started
7+
1. Initialize the DB
88

9-
First, run `npm run build` in the repository root.
9+
If you haven't already, you can initialize the database with the following command:
1010

11-
Next, run the development server:
11+
```bash
12+
cd docs && pnpm run init-db
13+
```
14+
15+
This will initialize an SQLite database at `./docs/sqlite.db`.
16+
17+
2. Setup environment variables
18+
19+
Copy the `.env.example` file to `.env.local` and set the environment variables.
20+
21+
```bash
22+
cp .env.example .env.local
23+
```
24+
25+
If you want to test logging in, or payments see more information below [in the environment variables section](#environment-variables).
26+
27+
3. Start the development server from within the `./docs` directory.
28+
29+
```bash
30+
pnpm run dev
31+
```
32+
33+
This will start the development server on port 3000.
34+
35+
## Environment Variables
36+
37+
### Logging in
38+
39+
To test logging in, you can set the following environment variables:
40+
41+
```bash
42+
AUTH_SECRET=test
43+
# Github OAuth optionally
44+
AUTH_GITHUB_ID=test
45+
AUTH_GITHUB_SECRET=test
46+
```
47+
48+
Note: the GITHUB_ID and GITHUB_SECRET are optional, but if you want to test logging in with Github you'll need to set them. For local development, you'll need to set the callback URL to `http://localhost:3000/api/auth/callback/github`
49+
50+
### Payments
51+
52+
To test payments, you can set the following environment variables:
53+
54+
```bash
55+
POLAR_ACCESS_TOKEN=test
56+
POLAR_WEBHOOK_SECRET=test
57+
```
58+
59+
For testing payments, you'll need access to the polar sandbox which needs to be configured to point a webhook to your local server. This can be configured at: <https://sandbox.polar.sh/dashboard/blocknote/settings/webhooks>
60+
61+
You'll need something like [ngrok](https://ngrok.com/) to expose your local server to the internet.
62+
63+
```bash
64+
ngrok http http://localhost:3000
65+
```
66+
67+
You'll need the webhook to point to ngrok like so:
68+
69+
```
70+
https://0000-00-00-000-00.ngrok-free.app/api/auth/polar/webhooks
71+
```
72+
73+
With this webhook pointing to your local server, you should be able to test payments.
74+
75+
### Email sending
76+
77+
Note, this is not required, if email sending is not configured, the app will log the email it would send to the console. Often this is more convenient for development.
78+
79+
To test email sending, you can set the following environment variables:
1280

1381
```bash
14-
npm run dev
82+
SMTP_HOST=
83+
SMTP_USER=
84+
SMTP_PASS=
85+
SMTP_PORT=
86+
SMTP_SECURE=false
1587
```
1688

17-
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
89+
When configured, you'll be able to send emails to the email address you've configured.
90+
91+
To setup with protonmail, you'll need to go to <https://account.proton.me/u/0/mail/imap-smtp> and create a new SMTP submission token.
92+
93+
You'll need to set the following environment variables:
94+
95+
```bash
96+
SMTP_HOST=smtp.protonmail.com
97+
98+
SMTP_PASS=my-smtp-token
99+
SMTP_PORT=587
100+
SMTP_SECURE=false
101+
```
18102

19-
## Merging
103+
# Contributing
20104

21-
Open a pull request to the [BlockNote GitHub repo](https://github.com/TypeCellOS/BlockNote). Pull requests will automatically be deployed to a preview environment.
105+
To submit your changes, open a pull request to the [BlockNote GitHub repo](https://github.com/TypeCellOS/BlockNote). Pull requests will automatically be deployed to a preview environment.

docs/components/pages/landing/community/Community.tsx renamed to docs/app/(home)/community/Community.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { FC } from "react";
2-
import { Contributors } from "@/components/pages/landing/community/Contributors";
3-
import { Section } from "@/components/pages/landing/shared/Section";
4-
import { Sponsors } from "@/components/pages/landing/community/Sponsors";
5-
import { SectionIntro } from "@/components/pages/landing/shared/Headings";
2+
import { Contributors } from "@/app/(home)/community/Contributors";
3+
import { Section } from "@/components/Section";
4+
import { Sponsors } from "@/app/(home)/community/Sponsors";
5+
import { SectionIntro } from "@/components/Headings";
66

77
export const Community: FC = () => (
88
<Section gradientBackground className="pb-24 pt-12 xl:pb-32 xl:pt-16">

docs/components/pages/landing/community/Contributors.tsx renamed to docs/app/(home)/community/Contributors.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { Link } from "nextra-theme-docs";
21
import Image from "next/image";
3-
import { DiscordIcon, GitHubIcon } from "nextra/icons";
4-
import { SectionSubHeader } from "@/components/pages/landing/shared/Headings";
5-
import { JoinButton } from "@/components/pages/landing/community/JoinButton";
6-
import { FadeIn } from "@/components/pages/landing/shared/FadeIn";
2+
import Link from "next/link";
3+
import { RiDiscordFill, RiGithubFill } from "react-icons/ri";
4+
import { SectionSubHeader } from "@/components/Headings";
5+
import { JoinButton } from "@/app/(home)/community/JoinButton";
6+
import { FadeIn } from "@/components/FadeIn";
77

88
// TODO: Use GitHub API
99
function fetchContributors(): { username: string; avatarUrl: string }[] {
@@ -114,7 +114,7 @@ export const Contributors = () => (
114114
subtext={
115115
"Join the community of BlockNote developers by contributing code and supporting the project."
116116
}
117-
icon={GitHubIcon}
117+
icon={<RiGithubFill size={32} />}
118118
linkTitle={"See our repository"}
119119
linkUrl={"https://github.com/TypeCellOS/BlockNote"}
120120
/>
@@ -123,7 +123,7 @@ export const Contributors = () => (
123123
subtext={
124124
"Ask questions, discuss features, and share your work with other BlockNote users on Discord."
125125
}
126-
icon={DiscordIcon}
126+
icon={<RiDiscordFill size={32} />}
127127
linkTitle={"Join our Server"}
128128
linkUrl={"https://discord.gg/Qc2QTTH5dF"}
129129
/>

docs/components/pages/landing/community/JoinButton.tsx renamed to docs/app/(home)/community/JoinButton.tsx

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,20 @@
1-
import { Link } from "nextra-theme-docs";
2-
import { ComponentProps, FC } from "react";
1+
import Link from "next/link";
2+
import { ReactNode } from "react";
33

44
export const JoinButton = (props: {
55
text: string;
66
subtext: string;
7-
icon: FC<ComponentProps<"svg">>;
7+
icon: ReactNode;
88
linkTitle: string;
99
linkUrl: string;
1010
}) => {
11-
const Icon = props.icon;
12-
1311
return (
1412
<div
1513
className={
16-
"flex w-full flex-col items-start justify-between gap-4 rounded-lg bg-gray-50 p-4 sm:flex-row sm:items-center sm:gap-8 md:max-w-screen-md dark:bg-gray-800"
14+
"border-fd-border flex w-full flex-col items-start justify-between gap-4 rounded-lg border p-4 sm:flex-row sm:items-center sm:gap-8 md:max-w-screen-md"
1715
}
1816
>
19-
<div className={"hidden md:block md:w-fit"}>
20-
<Icon width={30} />
21-
</div>
17+
<div className={"hidden md:block md:w-fit"}>{props.icon}</div>
2218
<div className={"flex w-full flex-col items-start justify-start"}>
2319
<h2
2420
className={

docs/components/pages/landing/community/SponsorCard.tsx renamed to docs/app/(home)/community/SponsorCard.tsx

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import ThemedImage from "@/components/ThemedImage";
12
import Image from "next/image";
23

34
export type SponsorCardProps = {
@@ -14,19 +15,13 @@ export function SponsorCard(props: SponsorCardProps) {
1415
return (
1516
<a
1617
href={props.link}
17-
className="relative flex aspect-video max-w-[235px] items-center justify-center rounded-lg bg-gray-100 md:w-[235px] dark:bg-gray-900"
18+
className="border-fd-border relative flex aspect-video max-w-[235px] items-center justify-center rounded-lg border"
1819
>
19-
<Image
20-
className={"block h-1/3 w-3/5 object-contain dark:hidden"}
21-
src={props.logo.light}
20+
<ThemedImage
21+
className={"h-1/3 w-3/5 object-contain"}
22+
src={{ light: props.logo.light, dark: props.logo.dark }}
2223
alt={props.name}
2324
/>
24-
<Image
25-
className={"hidden h-1/3 w-3/5 object-contain dark:block"}
26-
src={props.logo.dark}
27-
alt={props.name}
28-
/>
29-
3025
{props.tagline && (
3126
<div className={"absolute bottom-[10%] text-xs italic md:text-sm"}>
3227
{props.tagline}

0 commit comments

Comments
 (0)