Docusaurus Theme GitHub Codeblock Test Changes

A Docusaurus v2 plugin that supports referencing code examples from public GitHub repositories.

Note: this theme plugin requires Docusaurus v2


First, add the theme plugin to your dependencies as well as @babel/plugin-transform-modules-commonjs:

npm install @saucelabs/theme-github-codeblock @babel/plugin-transform-modules-commonjs


Add the theme plugin to your list of themes in the docusaurus.config.js:

    // ...
    themes: [
    // ...

in your babel.config.js please add @babel/plugin-transform-modules-commonjs to the plugins, e.g.:

module.exports = {
  presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
  plugins: [

In order to reference GitHub snippets in your markdown, create code blocks with a reference attached to the language meta string and put the link to your GitHub reference in the code block, e.g.:

```js reference

The plugin will download the code and display the desired lines:

Plugin Example

If you are interested contributing to this project, see