Repository navigation
Expand file tree
/
Copy pathdocusaurus.config.js
More file actions
356 lines (349 loc) · 12.8 KB
/
Copy pathdocusaurus.config.js
File metadata and controls
356 lines (349 loc) · 12.8 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
/* eslint-disable spellcheck/spell-checker */
// @ts-check
// Note: type annotations allow type checking and IDEs autocompletion
// require("@babel/register")({
// extensions: [".js", ".jsx"],
// presets: ["@babel/preset-env", "@babel/preset-react"],
// plugins: ["@babel/plugin-transform-modules-commonjs"],
// });
const path = require("path");
// Code block themes from the www.permit.io palette; contrast notes in each file.
const prismLightTheme = require("./src/css/prism/light");
const prismDarkTheme = require("./src/css/prism/dark");
const siteLinks = require("./src/data/site-links");
const nexusAnnouncement = require("./src/data/announcements");
// Shown when the owner flips announcements.js's `enabled` to true, or for a
// preview deploy via DOCS_ANNOUNCEMENT=<id> (matched against the id field).
// Undefined means Docusaurus renders no announcement bar at all.
const activeAnnouncement =
nexusAnnouncement.enabled || process.env.DOCS_ANNOUNCEMENT === nexusAnnouncement.id
? nexusAnnouncement
: undefined;
/** @type {import('@docusaurus/types').Config} */
const config = {
title: "Permit.io Documentation",
stylesheets: ["https://cdn.jsdelivr.net/npm/remixicon@4.2.0/fonts/remixicon.css"],
tagline:
"Permit is a Fullstack Authorization as a Service, allowing you to configure policies with a no-code UI and bake in enforcement points into your application, never having to write permissions again.",
url: "https://docs.permit.io",
baseUrl: "/",
// Netlify serves every page at its trailing-slash URL and 301s the bare path
// to it. Declaring that here keeps canonical, og:url, hreflang and the sitemap
// on the URL that answers 200, instead of on one that redirects.
trailingSlash: true,
onBrokenLinks: "throw",
favicon: "logo/favicon.ico",
organizationName: "permitio", // Usually your GitHub org/user name.
projectName: "docs", // Usually your repo name.
future: {
v4: {
removeLegacyPostBuildHeadAttribute: true,
useCssCascadeLayers: false,
},
},
markdown: {
mermaid: true,
hooks: {
onBrokenMarkdownLinks: "throw",
},
mdx1Compat: {
// Admonitions compat stays on: 251 legacy ":::type Title text" blocks
// across 111 files rely on it (auto-converted to a directive [Title]
// label). Disabling dropped ~1-27 admonitions per page on 110 pages —
// a real content rewrite, not a mechanical fix. See PR follow-ups.
comments: false,
admonitions: true,
headingIds: false,
},
},
themes: ["@docusaurus/theme-mermaid"],
presets: [
[
"@docusaurus/preset-classic",
{
gtag: {
trackingID: "G-S2W3HZX9EZ",
anonymizeIP: true,
},
docs: {
sidebarPath: require.resolve("./sidebars.js"),
routeBasePath: "/",
// Docusaurus appends the doc's own relative path (with its real
// extension) natively; no more hand-built .mdx-only URL in TOC.
editUrl: "https://github.com/permitio/docs/edit/master/",
lastVersion: "current",
versions: {
current: {
label: "2.0.0",
path: "/",
},
},
},
blog: false, // disables docusaurus blog
theme: {
customCss: require.resolve("./src/css/custom.scss"),
},
},
],
],
plugins: [
[
"@docusaurus/plugin-client-redirects",
{
redirects: require("./redirects"),
},
],
"docusaurus-plugin-sass",
"docusaurus-plugin-hotjar",
"docusaurus-plugin-image-zoom",
async function TailwindCSSPlugin(context, options) {
return {
name: "docusaurus-tailwindcss",
configurePostCss(postcssOptions) {
// Appends TailwindCSS and AutoPrefixer.
postcssOptions.plugins.push(require("tailwindcss"));
postcssOptions.plugins.push(require("autoprefixer"));
return postcssOptions;
},
};
},
[
"@inkeep/cxkit-docusaurus",
{
ChatButton: {
baseSettings: {
apiKey: "446287e718c0fd535135e7e51147a028a61120d17fd74d2f",
primaryBrandColor: "#8132D7",
organizationDisplayName: "Permit.io",
},
},
SearchBar: {
searchSettings: {
placeholder: "Search docs",
},
baseSettings: {
apiKey: "446287e718c0fd535135e7e51147a028a61120d17fd74d2f",
primaryBrandColor: "#8132D7",
organizationDisplayName: "Permit.io",
theme: {
// The trigger renders in a shadow root, so navbar CSS cannot reach
// it; page tokens (custom properties) still inherit. It fills the
// width _navbar.scss gives its host and shows only the icon when
// that host is narrow (below 1440px).
styles: [
{
key: "pm-navbar-search",
type: "style",
value: `
.ikp-search-bar__container { min-width: 0 !important; }
.ikp-search-bar__container button {
width: 100%;
border-color: var(--pm-border-strong);
background: transparent;
color: var(--pm-text-muted);
}
.ikp-search-bar__text {
overflow: hidden;
color: var(--pm-text-muted);
font-size: 0.875rem;
text-overflow: ellipsis;
white-space: nowrap;
}
@media (max-width: 1439px) {
.ikp-search-bar__container button { justify-content: center; padding: 0; }
.ikp-search-bar__container kbd { display: none; }
/* Visually hidden, not display:none, so the icon-only
button keeps "Search docs" as its accessible name. */
.ikp-search-bar__text {
display: block !important; /* Inkeep hides it on narrow viewports */
position: absolute; width: 1px; height: 1px;
overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
}
`,
},
],
},
},
},
},
],
],
themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
({
mermaid: {
options: {
themeVariables: {
edgeLabelBackground: "#F9EDE7",
},
},
},
zoom: {
selector: ".markdown :not(em) > img",
},
hotjar: {
// Added fake appID as variables are pulled from netlify & error without alternative
applicationId: process.env.HOTJAR_ID || "1234567890",
},
navbar: {
hideOnScroll: false,
logo: {
alt: "Permit.io Docs",
src: "logo/logo_nav.svg",
srcDark: "logo/logo-dark.svg",
href: "/",
target: "_self",
width: 110,
height: 20,
},
items: [
// Section tabs: each is backed by a sidebar in sidebars.js, so the tab
// stays active on every page of that section.
...[
["getStarted", "Get started"],
["concepts", "Concepts"],
["modeling", "Policies"],
["enforce", "Enforce"],
["aiAgents", "AI agents"],
["sdks", "SDKs & API"],
["integrations", "Integrations"],
["operate", "Operate"],
].map(([sidebarId, label]) => ({
type: "docSidebar",
sidebarId,
label,
position: "left",
className: "pm-nav-tab",
})),
{
type: "search",
position: "right",
className: "pm-nav-search",
},
{
label: "API reference",
href: siteLinks.API_REFERENCE,
position: "right",
className: "pm-nav-link",
},
{
type: "dropdown",
label: "permit.io",
position: "right",
className: "pm-nav-link pm-nav-www",
items: [
{ type: "html", value: '<span class="pm-dropdown-heading">Products</span>' },
...siteLinks.products.map(({ label, href }) => ({ label, href })),
{
type: "html",
value: '<span class="pm-dropdown-heading">Authorization models</span>',
},
...siteLinks.models.map(({ label, href }) => ({ label, href })),
{ type: "html", value: '<hr class="pm-dropdown-divider" />' },
{ label: "Pricing", href: siteLinks.PRICING },
{ label: "Trust Center", href: siteLinks.TRUST },
{ label: "Blog", href: siteLinks.BLOG },
],
},
{
type: "html",
position: "right",
className: "pm-nav-icon",
value: `<a href="${siteLinks.GITHUB}" target="_blank" rel="noopener noreferrer" aria-label="Permit.io on GitHub"><i class="ri-github-fill" aria-hidden="true"></i><span class="pm-nav-icon__label">GitHub</span></a>`,
},
{
type: "html",
position: "right",
className: "pm-nav-cta",
value: `<a href="${siteLinks.APP}" target="_blank" rel="noopener noreferrer">Open dashboard</a>`,
},
],
},
footer: {
// No `style: "dark"`: _footer.scss paints it from tokens so it follows
// the colour mode (a hard-coded dark footer would clash on the light theme).
logo: {
alt: "Permit.io Docs",
src: "logo/logo_nav.svg",
srcDark: "logo/logo-dark.svg",
href: "/",
width: 110,
height: 20,
},
links: [
{
title: "Docs",
items: [
{ label: "Quickstart", to: "/quickstart" },
{ label: "Concepts", to: "/overview/how-does-it-work" },
{ label: "SDKs", to: "/sdk/sdks-overview" },
{ label: "API reference", href: siteLinks.API_REFERENCE },
{ label: "Changelog", to: "/updates-and-feedback/changelog" },
{ label: "Status", href: siteLinks.STATUS },
],
},
{
title: "Products",
items: siteLinks.products.map(({ label, href }) => ({ label, href })),
},
{
title: "Resources",
items: [
{ label: "Blog", href: siteLinks.BLOG },
// The website has no models index page; RBAC links to the other three.
{ label: "Authorization models", href: siteLinks.models[0].href },
{ label: "Open source OPAL", href: siteLinks.OPAL },
{ label: "Videos", href: siteLinks.VIDEOS },
],
},
{
title: "Company",
items: [
{ label: "Trust Center", href: siteLinks.TRUST },
{ label: "Pricing", href: siteLinks.PRICING },
{ label: "Contact sales", href: siteLinks.DEMO },
{ label: "Community Slack", href: siteLinks.COMMUNITY },
{ label: "Privacy", href: siteLinks.PRIVACY },
{ label: "Terms", href: siteLinks.TERMS },
],
},
],
copyright: [
`<span class="pm-footer-copyright">© ${new Date().getFullYear()} Permit.io</span>`,
'<ul class="pm-footer-social">',
...[
["GitHub", siteLinks.GITHUB, "ri-github-fill"],
["Slack", siteLinks.COMMUNITY, "ri-slack-fill"],
["X", siteLinks.X, "ri-twitter-x-fill"],
["YouTube", siteLinks.YOUTUBE, "ri-youtube-fill"],
["LinkedIn", siteLinks.LINKEDIN, "ri-linkedin-box-fill"],
].map(
([name, href, icon]) =>
`<li><a href="${href}" target="_blank" rel="noopener noreferrer" aria-label="Permit.io on ${name}"><i class="${icon}" aria-hidden="true"></i></a></li>`
),
"</ul>",
].join(""),
},
prism: {
theme: prismLightTheme,
darkTheme: prismDarkTheme,
additionalLanguages: ["java", "ruby", "csharp", "groovy", "go", "hcl", "php", "bash"],
},
colorMode: {
defaultMode: "light",
disableSwitch: false,
respectPrefersColorScheme: true,
},
...(activeAnnouncement && {
announcementBar: {
id: activeAnnouncement.id,
content: activeAnnouncement.content,
backgroundColor: activeAnnouncement.backgroundColor,
textColor: activeAnnouncement.textColor,
isCloseable: activeAnnouncement.isCloseable,
},
}),
}),
};
module.exports = config;