Skip to content

Commit d303ba3

Browse files
authored
Merge pull request #313 from wpengine/remote-docs
chore: Remote docs
2 parents 9fe820c + d73a0d8 commit d303ba3

File tree

107 files changed

+1112
-5688
lines changed

Some content is hidden

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

107 files changed

+1112
-5688
lines changed

.vscode/launch.json

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "Next.js: debug server-side",
6+
"type": "node-terminal",
7+
"request": "launch",
8+
"command": "pnpm dev"
9+
},
10+
{
11+
"name": "Next.js: debug client-side",
12+
"type": "chrome",
13+
"request": "launch",
14+
"url": "http://localhost:3000"
15+
},
16+
{
17+
"name": "Next.js: debug client-side (Firefox)",
18+
"type": "firefox",
19+
"request": "launch",
20+
"url": "http://localhost:3000",
21+
"reAttach": true,
22+
"pathMappings": [
23+
{
24+
"url": "webpack://_N_E",
25+
"path": "${workspaceFolder}"
26+
}
27+
]
28+
},
29+
{
30+
"name": "Next.js: debug full stack",
31+
"type": "node",
32+
"request": "launch",
33+
"program": "${workspaceFolder}/node_modules/.bin/next",
34+
"runtimeArgs": ["--inspect"],
35+
"skipFiles": ["<node_internals>/**"],
36+
"serverReadyAction": {
37+
"action": "debugWithChrome",
38+
"killOnServerStop": true,
39+
"pattern": "- Local:.+(https?://.+)",
40+
"uriFormat": "%s",
41+
"webRoot": "${workspaceFolder}"
42+
}
43+
}
44+
]
45+
}

README.md

Lines changed: 6 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -37,34 +37,10 @@ Formatting - checks for spaces, line length, etc. i.e prettier
3737

3838
Both are run against staged files on commit. If it's failing for a good reason and you need to bypass you can use the `--no-verify` or `-n` flag. `git commit -nm "my message"`
3939

40-
## Documentation Docs
40+
## Editing content
4141

42-
Docs are MDX in the `docs` folder. Here are a couple things you should know!
43-
44-
1. Our MDX supports [Github Flavored Markdown](https://github.github.com/gfm/) (GFM).
45-
2. Images should be stored along side the doc that uses them.
46-
3. Shared Images can be stored in a shared folder @ `docs/images`
47-
4. [Callouts](https://github.com/lin-stephanie/rehype-callouts?tab=readme-ov-file#rehype-callouts): These are similar to block quotes or an aside but for various warnings, info, pro times, etc.
48-
5. Code Blocks:
49-
50-
- Required
51-
1. Specify a language: ` ```js ` or `` `const inlineCode = [1,2,3];{:js}` ``
52-
- Commands for a users terminal = `bash`
53-
- env files = `ini`
54-
- JavaScript = `js`
55-
- TypeScript = `ts`
56-
- GraphQL = `gql`
57-
- JSON = `json`
58-
- For a full list see: https://shiki.style/languages
59-
2. Add [line numbers](https://rehype-pretty.pages.dev/#line-numbers) to any complex code. `ini` and `bash` don't need to show line numbers generally. ` ```js showLineNumbers`
60-
3. Complete files should have a [file names](https://rehype-pretty.pages.dev/#titles) ` ```js title="pages/_app.js`
61-
- Optional
62-
63-
1. Lines can be [highlighted](https://rehype-pretty.pages.dev/#highlight-lines) in code blocks ` ```js {1,3-5}`. There are a variety of advanced highlighting methods, see: https://rehype-pretty.pages.dev/#highlight-lines
64-
2. Lines may be [diffed](https://shiki.style/packages/transformers#transformernotationdiff) in a code block:
65-
66-
```js
67-
console.log('hewwo') // [!code --]
68-
console.log('hello') // [!code ++]
69-
console.log('goodbye')
70-
```
42+
- Docs: [Located in the `faustjs` Repo under `/docs`](https://github.com/wpengine/faustjs/tree/canary/docs)\
43+
- Blog Posts & Pages: [Located in the headless WordPress CMS](https://cms.faustjs.org/wp-admin)
44+
- [Home Page](src/pages/index.jsx)
45+
- [Showcase](src/pages/showcase/index.jsx)
46+
- [Main Navigation](src/components/primary-nav.jsx)

next.config.mjs

Lines changed: 7 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,8 @@
1-
import { env } from "node:process";
21
import { withFaust, getWpHostname } from "@faustwp/core";
3-
import createMDX from "@next/mdx";
4-
import { transformerNotationDiff } from "@shikijs/transformers";
52
import { withWPEConfig } from "@wpengine/atlas-next";
63
import { createSecureHeaders } from "next-secure-headers";
7-
import recmaNextjsStaticProps from "recma-nextjs-static-props";
8-
import rehypeCallouts from "rehype-callouts";
9-
import rehypeMdxImportMedia from "rehype-mdx-import-media";
10-
import { rehypePrettyCode } from "rehype-pretty-code";
11-
import rehypeSlug from "rehype-slug";
12-
import remarkGfm from "remark-gfm";
134
import redirectsOldSite from "./redirects-old-site.mjs";
14-
import smartSearchPlugin from "./src/lib/smart-search-plugin.mjs";
5+
import { DOCS_PATH } from "./src/lib/remote-mdx-files.mjs";
156

167
const newRedirects = [
178
{
@@ -50,6 +41,11 @@ const nextConfig = {
5041
hostname: getWpHostname(),
5142
pathname: "/**",
5243
},
44+
{
45+
protocol: "https",
46+
hostname: "raw.githubusercontent.com",
47+
pathname: DOCS_PATH + "/**",
48+
},
5349
],
5450
},
5551
i18n: {
@@ -66,43 +62,6 @@ const nextConfig = {
6662
},
6763
];
6864
},
69-
webpack: (config, { isServer }) => {
70-
if (isServer) {
71-
config.plugins.push(
72-
smartSearchPlugin({
73-
endpoint: env.NEXT_PUBLIC_SEARCH_ENDPOINT,
74-
accessToken: env.NEXT_SEARCH_ACCESS_TOKEN,
75-
}),
76-
);
77-
}
78-
79-
return config;
80-
},
8165
};
8266

83-
const withMDX = createMDX({
84-
options: {
85-
recmaPlugins: [recmaNextjsStaticProps],
86-
remarkPlugins: [remarkGfm],
87-
rehypePlugins: [
88-
rehypeMdxImportMedia,
89-
rehypeSlug,
90-
rehypeCallouts,
91-
[
92-
rehypePrettyCode,
93-
{
94-
transformers: [
95-
transformerNotationDiff({
96-
matchAlgorithm: "v3",
97-
}),
98-
],
99-
theme: "github-dark-dimmed",
100-
defaultLang: "plaintext",
101-
bypassInlineCode: false,
102-
},
103-
],
104-
],
105-
},
106-
});
107-
108-
export default withWPEConfig(withFaust(withMDX(nextConfig)));
67+
export default withWPEConfig(withFaust(nextConfig));

package.json

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,15 @@
44
"scripts": {
55
"dev": "faust dev",
66
"build": "faust build",
7-
"postbuild": "next-sitemap --config next-sitemap.config.mjs",
7+
"postbuild": "concurrently \"pnpm build:sitemap\" \"pnpm build:search\"",
88
"generate": "faust generatePossibleTypes",
99
"stylesheet": "faust generateGlobalStylesheet",
1010
"start": "faust start",
1111
"test:format": "prettier . --check",
1212
"test:lint": "eslint --quiet",
13+
"test:search": "NODE_ENV=test node --env-file=.env.local ./scripts/smart-search.mjs",
14+
"build:search": "node ./scripts/smart-search.mjs",
15+
"build:sitemap": "next-sitemap --config next-sitemap.config.mjs",
1316
"lint": "eslint --fix",
1417
"format": "prettier . --write",
1518
"prepare": "husky"
@@ -23,35 +26,42 @@
2326
"@heroicons/react": "^2.2.0",
2427
"@icons-pack/react-simple-icons": "^12.0.0",
2528
"@js-temporal/polyfill": "^0.4.4",
26-
"@mdx-js/loader": "^3.0.1",
27-
"@mdx-js/react": "^3.0.1",
28-
"@next/mdx": "^15.1.7",
29+
"@jsdevtools/rehype-url-inspector": "^2.0.2",
30+
"@octokit/core": "^6.1.4",
2931
"@shikijs/transformers": "^3.0.0",
3032
"@sindresorhus/slugify": "^2.2.1",
3133
"@wpengine/atlas-next": "^2.0.0",
32-
"classnames": "^2.5.1",
3334
"date-fns": "^4.1.0",
3435
"downshift": "^9.0.8",
3536
"feed": "^4.2.2",
3637
"graphql": "^16.10.0",
37-
"html-to-text": "^9.0.5",
3838
"http-status-codes": "^2.3.0",
3939
"lodash.debounce": "^4.0.8",
4040
"next": "^15.1.7",
41+
"next-mdx-remote-client": "^2.1.1",
4142
"next-sitemap": "^4.2.3",
4243
"react": "^19.0.0",
4344
"react-dom": "^19.0.0",
44-
"recma-nextjs-static-props": "^2.0.1",
4545
"rehype-callouts": "^2.0.1",
46-
"rehype-mdx-import-media": "^1.2.0",
46+
"rehype-external-links": "^3.0.0",
4747
"rehype-pretty-code": "^0.14.0",
4848
"rehype-slug": "^6.0.0",
49+
"remark-flexible-toc": "^1.1.1",
50+
"remark-frontmatter": "^5.0.0",
4951
"remark-gfm": "^4.0.1",
50-
"shiki": "^3.0.0"
52+
"remark-parse": "^11.0.0",
53+
"remark-smartypants": "^3.0.2",
54+
"remark-stringify": "^11.0.0",
55+
"shiki": "^3.0.0",
56+
"strip-markdown": "^6.0.0",
57+
"unified": "^11.0.5",
58+
"unist-util-visit": "^5.0.0",
59+
"vfile-matter": "^5.0.0"
5160
},
5261
"devDependencies": {
5362
"@tailwindcss/postcss": "^4.0.7",
5463
"@tailwindcss/typography": "^0.5.15",
64+
"concurrently": "^9.1.2",
5565
"eslint": "^9.20.1",
5666
"eslint-config-neon": "^0.2.4",
5767
"eslint-plugin-mdx": "^3.1.5",

0 commit comments

Comments
 (0)