Skip to content

Commit e02b7a2

Browse files
authored
Fix styles from landing page pollutes the result (#40)
1 parent 9f54d4c commit e02b7a2

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ In "single" mode, the output will apply the values of all variables to the rules
228228
@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)`.
229229
@param {boolean} [options.onlyVariables=false] - Only output the color variables part of the CSS. Forces `preserveVariables` to be `true`.
230230
@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.
231+
@param {boolean} [options.useFixture=true] - Include extra styles from GitHub Flavored Markdown, like code snippets.
231232
@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`.
232233
*/
233234
// eslint-disable-next-line complexity
@@ -238,8 +239,8 @@ export default async function getCSS({
238239
preserveVariables = false,
239240
onlyVariables = false,
240241
onlyStyles = false,
241-
rootSelector = '.markdown-body',
242242
useFixture = true,
243+
rootSelector = '.markdown-body',
243244
} = {}) {
244245
if (onlyVariables && onlyStyles) {
245246
// Would result in an empty output
@@ -254,7 +255,8 @@ export default async function getCSS({
254255
preserveVariables = true;
255256
}
256257

257-
const body = await cachedFetch('https://github.com');
258+
// Note: Do not use the landing page (https://github.com/) to exclude styles on it
259+
const body = await cachedFetch('https://github.com/sindresorhus/generate-github-markdown-css');
258260
// Get a list of all css links on the page
259261
const links = unique(body.match(/(?<=href=").+?\.css/g));
260262
const renderMarkdownPromise = useFixture ? renderMarkdown() : Promise.resolve();

0 commit comments

Comments
 (0)