-
Notifications
You must be signed in to change notification settings - Fork 46
Expand file tree
/
Copy pathnext.config.mjs
More file actions
69 lines (67 loc) · 2.07 KB
/
next.config.mjs
File metadata and controls
69 lines (67 loc) · 2.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import nextra from "nextra";
import { createHighlighter } from "shiki";
import authzedGrammar from "./grammars/authzed.tmLanguage.json" with { type: "json" };
import celGrammar from "./grammars/cel.tmLanguage.json" with { type: "json" };
import textProtoGrammar from "./grammars/textproto.tmLanguage.json" with { type: "json" };
const withNextra = nextra({
latex: true,
search: { codeblocks: false },
defaultShowCopyCode: true,
mdxOptions: {
rehypePrettyCodeOptions: {
getHighlighter: (options) =>
createHighlighter({
...options,
langs: [
{
name: "zed",
scopeName: "source.authzed",
aliases: ["zed", "authzed"],
...authzedGrammar,
},
{
name: "cel",
scopeName: "source.cel",
aliases: ["cel"],
...celGrammar,
},
{
name: "textproto",
scopeName: "source.textproto",
aliases: ["textproto"],
...textProtoGrammar,
},
],
}),
},
},
});
export default withNextra({
basePath: process.env.NEXT_PUBLIC_BASE_DIR ?? undefined,
// This is necessary because we're using CDN domains.
// It adds `cross-origin="anonymous"` to script tags
crossOrigin: "anonymous",
assetPrefix:
process.env.VERCEL_ENV === "production" ? "https://docs-authzed.vercel.app/docs" : undefined,
// NOTE: we still use webpack instead of turbopack for dev
// because turbopack doesn't support non-serializable nextjs options.
// The rehypePrettyCodeOptions in the block above include a function,
// which cannot be serialized. If nextra figures out how to provide
// those options in a different manner or if turbopack starts supporting
// them we can migrate.
webpack: (config) => {
config.module.rules.push(
...[
{
test: /\.yaml$/,
use: "yaml-loader",
},
{
test: /\.svg$/,
use: "@svgr/webpack",
},
],
);
return config;
},
});