You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+21-12Lines changed: 21 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,6 +15,7 @@ Includes OS dark mode support 🌙
15
15
-[Languages](#languages)
16
16
-[Themes](#themes)
17
17
-[Using languages and themes from an extension](#using-languages-and-themes-from-an-extension)
18
+
-[Dealing with rate limiting in CI](#dealing-with-rate-limiting-in-ci)
18
19
-[Styles](#styles)
19
20
-[Class names](#class-names)
20
21
-[Variables](#variables)
@@ -56,17 +57,19 @@ Add to your `gatsby-config.js` (all options are optional; defaults shown here):
56
57
// All options are optional. Defaults shown here.
57
58
options: {
58
59
colorTheme:'Dark+ (default dark)', // Read on for list of included themes. Also accepts object and function forms.
59
-
wrapperClassName:'', // Additional class put on 'pre' tag
60
-
injectStyles:true, // Injects (minimal) additional CSS for layout and scrolling
61
-
extensions: [], // Extensions to download from the marketplace to provide more languages and themes
62
-
languageAliases: {}, // Map of custom/unknown language codes to standard/known language codes
63
-
replaceColor:x=> x, // Function allowing replacement of a theme color with another. Useful for replacing hex colors with CSS variables.
64
-
getLineClassName: ({ // Function allowing dynamic setting of additional class names on individual lines
65
-
content, // - the string content of the line
66
-
index, // - the zero-based index of the line within the code fence
67
-
language, // - the language specified for the code fence
68
-
codeFenceOptions // - any options set on the code fence alongside the language (more on this later)
69
-
}) =>''
60
+
wrapperClassName:'', // Additional class put on 'pre' tag
61
+
injectStyles:true, // Injects (minimal) additional CSS for layout and scrolling
62
+
extensions: [], // Extensions to download from the marketplace to provide more languages and themes
63
+
languageAliases: {}, // Map of custom/unknown language codes to standard/known language codes
64
+
replaceColor:x=> x, // Function allowing replacement of a theme color with another. Useful for replacing hex colors with CSS variables.
65
+
getLineClassName: ({ // Function allowing dynamic setting of additional class names on individual lines
66
+
content, // - the string content of the line
67
+
index, // - the zero-based index of the line within the code fence
68
+
language, // - the language specified for the code fence
69
+
codeFenceOptions // - any options set on the code fence alongside the language (more on this later)
70
+
}) =>'',
71
+
extensionDataDirectory:// Absolute path to the directory where extensions will be downloaded. Defaults to inside node_modules.
72
+
path.resolve('extensions'),
70
73
}
71
74
}]
72
75
}
@@ -211,7 +214,13 @@ Add those strings to the `extensions` option in your plugin configuration in `ga
211
214
}]
212
215
```
213
216
214
-
Next time you `gatsby develop` or `gatsby build`, the extension will be downloaded and Scala code fences will be highlighted. Extensions are downloaded to `node_modules/gatsby-remark-vscode/lib/extensions`, so they remain cached on disk as long as `gastsby-remark-vscode` does.
217
+
Next time you `gatsby develop` or `gatsby build`, the extension will be downloaded and Scala code fences will be highlighted. Extensions are downloaded to `node_modules/gatsby-remark-vscode/lib/extensions` by default (but can go elsewhere by setting the `extensionDataDirectory` option), so they remain cached on disk as long as `gastsby-remark-vscode` does.
218
+
219
+
### Dealing with rate limiting in CI
220
+
221
+
Anonymous requests to the Visual Studio Marketplace are rate limited, so if you’re downloading a lot of extensions or running builds in quick succession in an environment where the extensions aren’t already cached on disk (like on a build server), you might see failed requests.
222
+
223
+
As a workaround, you can set the `extensionDataDirectory` plugin option to an absolute path pointing to a folder that you check into source control. After running a build locally, any extensions you’ve requested will appear in that directory. Then, in CI, gatsby-remark-vscode will check that directory and determine if anything needs to be downloaded. By checking including the extensions alongside your own source code, you can avoid making requests to the Visual Studio Marketplace in CI entirely.
0 commit comments