Skip to content

Commit 8fe9de9

Browse files
committed
Update README (#116)
* Remove unused options from README and plugin options schema * Add new options to the README and actually indent the default options * Fix formatting and make Default always on top * Move README * Finish incomplete item and make postCssPlugins block behave with linter * Add main header and intro blurb
1 parent 9b6679f commit 8fe9de9

File tree

4 files changed

+178
-81
lines changed

4 files changed

+178
-81
lines changed

README.md

+6-76
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,8 @@
1-
# Gatsby Theme: Iterative
1+
# Gatsby Theme: Iterative development monorepo
22

3-
This Gatsby Theme houses the shared website code for all websites for
4-
[Iterative](https://iterative.ai). This package is currently purpose-built
5-
specifically for our websites and not very useful outside of them, but we intend
6-
to change that as we make improvements and iron out issues!
3+
This repo is dedicated to the development of `gatsby-theme-iterative`, a shared
4+
code bundle used between all the Gatsby websites hosted by
5+
[Iterative, inc](iterative.ai)!
76

8-
## Usage
9-
10-
### Options
11-
12-
- disable: boolean Default: Boolean(process.env.SKIP_DOCS)
13-
14-
- getTemplate: function Default: () => defaultGetTemplate
15-
16-
- defaultTemplate: string Default: require.resolve('./src/templates/doc.tsx')
17-
18-
- remark: boolean Default: true
19-
20-
- filesystem: boolean Default: true
21-
22-
- glossaryDirectory: string Default: 'docs/user-guide/basic-concepts'
23-
24-
- simpleLinkerTerms: { matches: string, url: string }[] These terms will be
25-
passed to the simpleLinker remark plugin
26-
27-
- cssBase: string Used as base files for global PostCSS variables and queries
28-
29-
- customMediaConfig: object config passed to `postcss-custom-media`
30-
31-
- customPropertiesConfig: object config passed to `postcss-custom-properties`
32-
33-
- colorModConfig: object config passed to `postcss-color-mod`
34-
35-
- postCssPlugins: Plugin[] If specified, this array will completely replace
36-
plugins this theme passes to PostCSS. This is mostly an escape hatch for if
37-
styles are broken with the default plugins. Check out
38-
[the theme's `gatsby-config`](https://github.com/iterative/gatsby-theme-iterative/blob/main/packages/gatsby-theme-iterative/gatsby-config.js)
39-
to see the default plugins, as not having them in this option will very likely
40-
break core functionality.
41-
42-
### Examples
43-
44-
See this example from
45-
[the example website's `gatsby-config.js`](https://github.com/iterative/gatsby-theme-iterative/blob/main/packages/example/gatsby-config.js).
46-
47-
```js
48-
const path = require('path')
49-
const {
50-
name: themePackageName
51-
} = require('../gatsby-theme-iterative/package.json')
52-
53-
module.exports = {
54-
trailingSlash: 'never',
55-
siteMetadata: {
56-
title: 'Example website',
57-
description: 'Example website description',
58-
keywords: ['docs', 'test'],
59-
siteUrl: 'http://localhost:8000'
60-
},
61-
plugins: [
62-
{
63-
resolve: themePackageName,
64-
options: {
65-
simpleLinkerTerms: require('./content/linked-terms')
66-
}
67-
},
68-
{
69-
resolve: 'gatsby-source-filesystem',
70-
options: {
71-
name: 'images',
72-
path: path.join(__dirname, 'static', 'img')
73-
}
74-
},
75-
'@sentry/gatsby'
76-
]
77-
}
78-
```
7+
For more details about the theme itself, check out its
8+
[README](packages/gatsby-theme-iterative/README.md)!
+156
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
# Gatsby Theme: Iterative
2+
3+
This Gatsby theme is what [Iterative, inc.](https://iterative.ai) uses to power
4+
all of our Gatsby websites! It contains all of our shared utility code, as well
5+
as our full docs engine. This project is still evolving, and while it's
6+
currently very specific to iterative.ai websites we hope to make it usable for
7+
others in the future.
8+
9+
## Usage
10+
11+
### Options
12+
13+
- disable: boolean
14+
15+
Default: Boolean(process.env.SKIP_DOCS)
16+
17+
Stops this theme from making pages. Could be used as a conditional for test
18+
and development purposes.
19+
20+
- defaultTemplate: string
21+
22+
Default: require.resolve('./src/templates/doc.tsx')
23+
24+
Will be passed to the `getTemplate` function to use as a default template, the
25+
default function simply returns this if `template` isn't specified.
26+
27+
- getTemplate: function
28+
29+
Default:
30+
31+
```ts
32+
const defaultGetTemplate = (template, defaultTemplate) =>
33+
template
34+
? require.resolve(path.resolve('src', 'templates', template + '.tsx'))
35+
: defaultTemplate
36+
```
37+
38+
This function will be given the `template` field specified in the page's
39+
frontmatter, as well as the `defaultTemplate` specified by the option above.
40+
It is expected to return the absolute path to a React component to be given to
41+
Gatsby's `createPage` action.
42+
43+
- remark: boolean
44+
45+
Default: true
46+
47+
if true, this theme will add its own instance of `gatsby-transformer-remark`.
48+
49+
- filesystem: boolean
50+
51+
Default: true
52+
53+
if true, this theme will add its own instance of `gatsby-source-filesystem`.
54+
55+
- glossaryPath: string
56+
57+
Default: path.resolve('content', 'docs', 'user-guide', 'basic-concepts')
58+
59+
- simpleLinkerTerms: { matches: string, url: string }[]
60+
61+
Default: undefined
62+
63+
These terms will be passed to `plugins/gatsby-remark-dvc-linker`, which will
64+
scan code blocks for ones with content matching `matches`, and then link it to
65+
that entry's `url`.
66+
67+
- postCssPlugins: Plugin[]
68+
69+
Default:
70+
71+
```js
72+
const postCssPlugins = [
73+
require('tailwindcss/nesting')(require('postcss-nested')),
74+
autoprefixer,
75+
require('tailwindcss')
76+
]
77+
```
78+
79+
If specified, this array will completely replace plugins this theme passes to
80+
PostCSS. This is mostly an escape hatch for if styles are broken with the
81+
default plugins. Check out
82+
[the theme's `gatsby-config`](https://github.com/iterative/gatsby-theme-iterative/blob/main/packages/gatsby-theme-iterative/gatsby-config.js)
83+
to see the default plugins, as not having them in this option will very likely
84+
break core functionality.
85+
86+
- docsInstanceName: string
87+
88+
Default: 'iterative-docs'
89+
90+
The `name` that will be passed to the `gatsby-source-filesystem` instance for
91+
docs pages. The resulting `sourceInstanceName` will be used to identify files
92+
that will be processed as docs pages.
93+
94+
- docsPath: string
95+
96+
Default: path.resolve('content', 'docs')
97+
98+
- glossaryInstanceName: string
99+
100+
Default: 'iterative-glossary'
101+
102+
The `name` that will be passed to the `gatsby-source-filesystem` instance for
103+
glossary entries. The resulting `sourceInstanceName` will be used to identify
104+
files that will be processed as glossary pages.
105+
106+
- argsLinkerPath: string
107+
108+
Default: ['command-reference', `ref`, 'cli-reference']
109+
110+
The path that `plugins/gatsby-remark-args-linker` will operate on, connecting
111+
arguments listed in the summary with their summaries deeper in the page.
112+
113+
- docsPrefix: string
114+
115+
Default: 'doc'
116+
117+
This is the prefix that the docs pages will render to, including the index
118+
page at the exact path.
119+
120+
### Examples
121+
122+
See this example from
123+
[the example website's `gatsby-config.js`](https://github.com/iterative/gatsby-theme-iterative/blob/main/packages/example/gatsby-config.js).
124+
125+
```js
126+
const path = require('path')
127+
const {
128+
name: themePackageName
129+
} = require('../gatsby-theme-iterative/package.json')
130+
131+
module.exports = {
132+
trailingSlash: 'never',
133+
siteMetadata: {
134+
title: 'Example website',
135+
description: 'Example website description',
136+
keywords: ['docs', 'test'],
137+
siteUrl: 'http://localhost:8000'
138+
},
139+
plugins: [
140+
{
141+
resolve: themePackageName,
142+
options: {
143+
simpleLinkerTerms: require('./content/linked-terms')
144+
}
145+
},
146+
{
147+
resolve: 'gatsby-source-filesystem',
148+
options: {
149+
name: 'images',
150+
path: path.join(__dirname, 'static', 'img')
151+
}
152+
},
153+
'@sentry/gatsby'
154+
]
155+
}
156+
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
const path = require('path')
2+
3+
module.exports = {
4+
docsPath: path.resolve('content', 'docs'),
5+
docsInstanceName: 'iterative-docs',
6+
glossaryPath: path.resolve('content', 'docs', 'user-guide', 'basic-concepts'),
7+
glossaryInstanceName: 'iterative-glossary',
8+
argsLinkerPath: ['command-reference', `ref`, 'cli-reference']
9+
}

packages/gatsby-theme-iterative/gatsby-node.js

+7-5
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,19 @@ exports.pluginOptionsSchema = ({ Joi }) => {
1515
),
1616
remark: Joi.boolean().default(true),
1717
filesystem: Joi.boolean().default(true),
18-
glossaryDirectory: Joi.string().default('docs/user-guide/basic-concepts'),
18+
glossaryPath: Joi.string().default(
19+
path.resolve('content', 'docs', 'user-guide', 'basic-concepts')
20+
),
21+
docsDirectory: Joi.string().default(path.resolve('content', 'docs')),
22+
glossaryInstanceName: Joi.string().default('iterative-glossary'),
23+
docsInstanceName: Joi.string().default('iterative-docs'),
24+
docsPrefix: Joi.string().default('doc'),
1925
simpleLinkerTerms: Joi.array().items(
2026
Joi.object({
2127
matches: Joi.string(),
2228
url: Joi.string()
2329
})
2430
),
25-
cssBase: Joi.string(),
26-
customMediaConfig: Joi.object(),
27-
customPropertiesConfig: Joi.object(),
28-
colorModConfig: Joi.object(),
2931
postCssPlugins: Joi.array(),
3032
plausibleSrc: [Joi.string().optional(), Joi.allow(null)],
3133
plausibleAPI: [Joi.string().optional(), Joi.allow(null)],

0 commit comments

Comments
 (0)