@saucelabs/theme-github-codeblock
TypeScript icon, indicating that this package has built-in type declarations

0.2.3 • Public • Published

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

Install

First, add the theme plugin to your dependencies:

# NPM
npm install --save @saucelabs/theme-github-codeblock

# Yarn
yarn add @saucelabs/theme-github-codeblock

Usage

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

    // ...
    themes: [
        '@saucelabs/theme-github-codeblock'
    ],
    // ...

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
https://github.com/saucelabs/docusaurus-theme-github-codeblock/blob/main/src/theme/ReferenceCodeBlock/index.tsx#L105-L108
```

You can also set a custom title:

```js reference title="Example"
https://github.com/saucelabs/docusaurus-theme-github-codeblock/blob/main/src/theme/ReferenceCodeBlock/index.tsx#L105-L108
```

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

Plugin Example


If you are interested contributing to this project, see CONTRIBUTING.md.

/@saucelabs/theme-github-codeblock/

    Package Sidebar

    Install

    npm i @saucelabs/theme-github-codeblock

    Weekly Downloads

    1,170

    Version

    0.2.3

    License

    MIT

    Unpacked Size

    24.5 kB

    Total Files

    20

    Last publish

    Collaborators

    • william.nunes-sl
    • christina.tonkonogaya
    • joaquin.hurtado
    • webdev-saucelabs
    • gracjan.grala
    • david.missmann
    • thomas.fett
    • aluedeke_sauce
    • pawel-sauce
    • nick.sauce
    • diego.molina
    • sakhi-sl
    • navrajsingh
    • it10403npm
    • rillgen-saucelabs
    • saucebot
    • krzysztof.sulejczak.sauce