Skip to content

Commit

Permalink
feat: Change mdx flag into mdxOtherwise to prevent confusion (#21404)
Browse files Browse the repository at this point in the history
* Change flag name to prevent confusion

* Still check mdx flag so we don't break existing theme usage
  • Loading branch information
LB authored Feb 24, 2020
1 parent 40ac9be commit 6874cca
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 23 deletions.
12 changes: 6 additions & 6 deletions packages/gatsby-theme-blog-core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ module.exports = {

### Theme options

| Key | Default value | Description |
| ------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `basePath` | `/` | Root url for all blog posts |
| `contentPath` | `content/posts` | Location of blog posts |
| `assetPath` | `content/assets` | Location of assets |
| `mdx` | `true` | Configure `gatsby-plugin-mdx`. Note that most sites will not need to use this flag. If your site has already configured `gatsby-plugin-mdx` separately, set this flag `false`. |
| Key | Default value | Description |
| ------------------------ | ---------------- | -------------------------------------------------------------------------------- |
| `basePath` | `/` | Root url for all blog posts |
| `contentPath` | `content/posts` | Location of blog posts |
| `assetPath` | `content/assets` | Location of assets |
| `mdxOtherwiseConfigured` | `false` | Set this flag `true` if `gatsby-plugin-mdx` is already configured for your site. |

#### Example usage

Expand Down
5 changes: 3 additions & 2 deletions packages/gatsby-theme-blog-core/gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ const withDefaults = require(`./utils/default-options`)

module.exports = themeOptions => {
const options = withDefaults(themeOptions)
const { mdx = true } = themeOptions
let { mdxOtherwiseConfigured = false, mdx: legacyConfigureMdxFlag = true } = themeOptions // keep mdx flag so we don't introduce a breaking change

return {
siteMetadata: {
title: `Blog Title Placeholder`,
Expand All @@ -20,7 +21,7 @@ module.exports = themeOptions => {
],
},
plugins: [
mdx && {
(!mdxOtherwiseConfigured && legacyConfigureMdxFlag) && {
resolve: `gatsby-plugin-mdx`,
options: {
extensions: [`.mdx`, `.md`],
Expand Down
12 changes: 6 additions & 6 deletions packages/gatsby-theme-blog/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ module.exports = {

### Theme options

| Key | Default value | Description |
| ------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `basePath` | `/` | Root url for all blog posts |
| `contentPath` | `content/posts` | Location of blog posts |
| `assetPath` | `content/assets` | Location of assets |
| `mdx` | `true` | Configure `gatsby-plugin-mdx`. Note that most sites will not need to use this flag. If your site has already configured `gatsby-plugin-mdx` separately, set this flag `false`. |
| Key | Default value | Description |
| ------------------------ | ---------------- | -------------------------------------------------------------------------------- |
| `basePath` | `/` | Root url for all blog posts |
| `contentPath` | `content/posts` | Location of blog posts |
| `assetPath` | `content/assets` | Location of assets |
| `mdxOtherwiseConfigured` | `false` | Set this flag `true` if `gatsby-plugin-mdx` is already configured for your site. |

#### Example configuration

Expand Down
17 changes: 10 additions & 7 deletions packages/gatsby-theme-notes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,17 @@ module.exports = {
```

3. Add notes to your site by creating `md` or `mdx` files inside `/content/notes`.

> Note that if you've changed the default `contentPath` in the configuration, you'll want to add your markdown files in the directory specified by that path.
4. Run your site using `gatsby develop` and navigate to your notes. If you used the above configuration, your URL will be `http://localhost:8000/notes`

### Options

| Key | Default value | Description |
| --------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `basePath` | `/` | Root url for all notes pages |
| `contentPath` | `/content/notes` | Location of notes content |
| `mdx` | `true` | Configure `gatsby-plugin-mdx`. Note that most sites will not need to use this flag. If your site has already configured `gatsby-plugin-mdx` separately, set this flag `false`. |
| `homeText` | `~` | Root text for notes breadcrumb trail |
| `breadcrumbSeparator` | `/` | Separator for the breadcrumb trail |
| Key | Default value | Description |
| ------------------------ | ---------------- | -------------------------------------------------------------------------------- |
| `basePath` | `/` | Root url for all notes pages |
| `contentPath` | `/content/notes` | Location of notes content |
| `mdxOtherwiseConfigured` | `false` | Set this flag `true` if `gatsby-plugin-mdx` is already configured for your site. |
| `homeText` | `~` | Root text for notes breadcrumb trail |
| `breadcrumbSeparator` | `/` | Separator for the breadcrumb trail |
4 changes: 2 additions & 2 deletions packages/gatsby-theme-notes/gatsby-config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = options => {
const { mdx = true, mdxLayouts = {} } = options
const { mdxOtherwiseConfigured = false, mdx: legacyConfigureMdxFlag = true, mdxLayouts = {} } = options

return {
siteMetadata: {
Expand All @@ -8,7 +8,7 @@ module.exports = options => {
siteUrl: `http://example.com/`,
},
plugins: [
mdx && {
(!mdxOtherwiseConfigured && legacyConfigureMdxFlag) && {
resolve: `gatsby-plugin-mdx`,
options: {
extensions: [`.md`, `.mdx`],
Expand Down

0 comments on commit 6874cca

Please sign in to comment.