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: index.js
+18-26Lines changed: 18 additions & 26 deletions
Original file line number
Diff line number
Diff line change
@@ -284,30 +284,24 @@ function applyColors(colors, rules) {
284
284
}
285
285
286
286
/**
287
-
* Extract markdown styles from github.com
288
-
*
289
-
* If the `light` and `dark` themes are different the CSS returned will include
290
-
* `prefers-color-scheme` blocks for light and dark that match the specified
291
-
* `light` and `dark` themes (considered "auto" mode). This mode will always
292
-
* `preserveVars` as they are necessary for the `prefers-color-scheme` blocks
293
-
*
294
-
* If the `light` and `dark` themes are equal the output will only contain one
295
-
* theme (considered "single" mode)
296
-
*
297
-
* In "single" mode the output will apply the values of all variables to the
298
-
* rules themselves.The output will not contain any `var(--variable)` statements.
299
-
* You can disable this by setting `preserveVariables` to true
300
-
*
301
-
* @param {Object} options optional options object
302
-
* @param {string} [options.light=light] The theme to use for light theme
303
-
* @param {string} [options.dark=dark] The theme to use for dark theme
304
-
* @param {boolean} [options.list=false] If `true` will return a list of available themes instead of the CSS
305
-
* @param {boolean} [options.preserveVariables=false] If `true` will preserve the block of variables for a given theme even if only exporting one theme. By default variables are applied to the rules themselves and the resulting CSS will not contain any `var(--variable)`
306
-
* @param {boolean} [options.onlyVariables=false] Only output the color variables part of the css. forces `preserveVariables` to be `true`
307
-
* @param {boolean} [options.onlyStyles=false] Only output the style part of the css without any variables. forces `preserveVariables` to be `true` and ignores the theme values. Useful to get the base styles to use multiple themes
308
-
* @param {string} [options.rootSelector=.markdown-body] Set the root selector of the rendered markdown body as it should appear in the output css. Defaults to `.markdown-body`
309
-
*/
310
-
asyncfunctiongetCSS({
287
+
Extract markdown styles from github.com
288
+
289
+
If the `light` and `dark` themes are different, the returned CSS will include `prefers-color-scheme` blocks for light and dark that match the specified `light` and `dark` themes (considered "auto" mode). This mode will always `preserveVariables` as they are necessary for the `prefers-color-scheme` blocks
290
+
291
+
If the `light` and `dark` themes are equal, the output will only contain one theme (considered "single" mode).
292
+
293
+
In "single" mode, the output will apply the values of all variables to the rules themselves. The output will not contain any `var(--variable)` statements. You can disable this by setting `preserveVariables` to `true`.
@param {string} [options.light=light] - The theme to use for light theme.
297
+
@param {string} [options.dark=dark] - The theme to use for dark theme.
298
+
@param {boolean} [options.list=false] - If `true`, will return a list of available themes instead of the CSS.
299
+
@param {boolean} [options.preserveVariables=false] - If `true`, will preserve the block of variables for a given theme even if only exporting one theme. By default, variables are applied to the rules themselves and the resulting CSS will not contain any `var(--variable)`.
300
+
@param {boolean} [options.onlyVariables=false] - Only output the color variables part of the CSS. Forces `preserveVariables` to be `true`.
301
+
@param {boolean} [options.onlyStyles=false] - Only output the style part of the CSS without any variables. Forces `preserveVariables` to be `true` and ignores the theme values. Useful to get the base styles to use multiple themes.
302
+
@param {string} [options.rootSelector=.markdown-body] - Set the root selector of the rendered Markdown body as it should appear in the output CSS. Defaults to `.markdown-body`.
* If the `light` and `dark` themes are different the CSS returned will include
20
-
* `prefers-color-scheme` blocks for light and dark that match the specified
21
-
* `light` and `dark` themes (considered "auto" mode). This mode will always
22
-
* `preserveVars` as they are necessary for the `prefers-color-scheme` blocks
23
-
*
24
-
* If the `light` and `dark` themes are equal the output will only contain one
25
-
* theme (considered "single" mode)
26
-
*
27
-
* In "single" mode the output will apply the values of all variables to the
28
-
* rules themselves.The output will not contain any `var(--variable)` statements.
29
-
* You can disable this by setting `preserveVariables` to true
30
-
*/
19
+
If the `light` and `dark` themes are different the CSS returned will include `prefers-color-scheme` blocks for light and dark that match the specified `light` and `dark` themes (considered "auto" mode). This mode will always `preserveVars` as they are necessary for the `prefers-color-scheme` blocks
20
+
21
+
If the `light` and `dark` themes are equal the output will only contain one theme (considered "single" mode)
22
+
23
+
In "single" mode the output will apply the values of all variables to the rules themselves.The output will not contain any `var(--variable)` statements. You can disable this by setting `preserveVariables` to true
24
+
*/
31
25
32
26
console.log(awaitgithubMarkdownCss({
33
-
// The theme to use for light theme
34
-
light:"light",
35
-
// The theme to use for dark theme
36
-
dark:"dark",
37
-
// If `true` will return a list of available themes instead of the CSS
38
-
list =false,
39
-
// If `true` will preserve the block of variables for a given theme even if
40
-
// only exporting one theme. By default variables are applied to the rules
41
-
// themselves and the resulting CSS will not contain any `var(--variable)`
42
-
preserveVariables =false,
43
-
// Only output the color variables part of the css. forces
44
-
// `preserveVariables` to be `true`
45
-
onlyVariables =false,
46
-
// Only output the style part of the css without any variables. forces
47
-
// `preserveVariables` to be `true` and ignores the theme values.
48
-
// Useful to get the base styles to use multiple themes
49
-
onlyStyles =false,
50
-
// Set the root selector of the rendered markdown body as it should appear
51
-
// in the output css. Defaults to `.markdown-body`
52
-
rootSelector ='.markdown-body',
53
-
}));
27
+
// The theme to use for light theme.
28
+
light:'light',
29
+
// The theme to use for dark theme.
30
+
dark:'dark',
31
+
// If `true`, will return a list of available themes instead of the CSS.
32
+
list =false,
33
+
// If `true`, will preserve the block of variables for a given theme even if
34
+
// only exporting one theme. By default, variables are applied to the rules
35
+
// themselves and the resulting CSS will not contain any `var(--variable)`.
36
+
preserveVariables =false,
37
+
// Only output the color variables part of the CSS. Forces
38
+
// `preserveVariables` to be `true`.
39
+
onlyVariables =false,
40
+
// Only output the style part of the CSS without any variables. Forces
41
+
// `preserveVariables` to be `true` and ignores the theme values.
42
+
// Useful to get the base styles to use multiple themes.
43
+
onlyStyles =false,
44
+
// Set the root selector of the rendered Markdown body as it should appear
45
+
// in the output CSS. Defaults to `.markdown-body`.
0 commit comments