Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(gatsby-remark-code-repls): move config per provider #12936

Merged
merged 20 commits into from
Jun 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 34 additions & 26 deletions packages/gatsby-remark-code-repls/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,42 +134,50 @@ specified examples directory. (This will avoid broken links at runtime.)
// eg <a href="...">Click here</a>
defaultText: 'Click here',

// Optional runtime dependencies to load from NPM.
// This option only applies to REPLs that support it (eg CodeSandbox).
// eg ['react', 'react-dom'] or ['react@15', 'react-dom@15']
dependencies: [],

// Example code links are relative to this dir.
// eg examples/path/to/file.js
directory: `${__dirname}/examples/`,

// Optional externals to load from a CDN.
// This option only applies to REPLs that support it (eg Codepen).
// eg '//unpkg.com/react/umd/react.development.js'
externals: [],

// Optional HTML contents to inject into REPL.
// Defaults to `<div id="root"></div>`.
// This option only applies to REPLs that support it (eg Codepen, CodeSandbox).
// eg '<div id="root"></div>'
html: '',

// Optional path to a custom redirect template.
// The redirect page is only shown briefly,
// But you can use this setting to override its CSS styling.
redirectTemplate: `${__dirname}/src/redirect-template.js`,

// Optional link target.
// Note that if a target is specified, "noreferrer" will also be added.
// eg <a href="..." target="_blank" rel="noreferrer">...</a>
target: '_blank',

// Include CSS with matching name.
// This option only applies to REPLs that support it (eg Codepen).
// If set to `true`, when specifying `file1.js` as example file,
// it will try to inject the CSS in `file1.css` if the file exists,
// otherwise the default behaviour is preserved
includeMatchingCSS: false,

// Provider specific options
codepen: {
// Optional path to a custom redirect template.
// The redirect page is only shown briefly,
// But you can use this setting to override its CSS styling.
redirectTemplate: `${__dirname}/src/redirect-template.js`,

// Optional HTML contents to inject into REPL.
// Defaults to `<div id="root"></div>`.
// eg '<div id="root"></div>'
html: '',

// Optional externals to load from a CDN.
// eg '//unpkg.com/react/umd/react.development.js'
externals: [],

// Include CSS with matching name.
// If set to `true`, when specifying `file1.js` as example file,
// it will try to inject the CSS in `file1.css` if the file exists,
// otherwise the default behaviour is preserved
includeMatchingCSS: false,
},

codesandbox: {
// Optional HTML contents to inject into REPL.
// Defaults to `<div id="root"></div>`.
// eg '<div id="root"></div>'
html: '',

// Optional runtime dependencies to load from NPM.
// eg ['react', 'react-dom'] or ['react@15', 'react-dom@15']
dependencies: [],
}
},
},
```
Loading