Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@saucelabs/theme-github-codeblock

Package Overview
Dependencies
Maintainers
14
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@saucelabs/theme-github-codeblock

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

latest
Source
npmnpm
Version
0.3.0
Version published
Weekly downloads
10K
59.16%
Maintainers
14
Weekly downloads
 
Created
Source

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.

Keywords

docusarus

FAQs

Package last updated on 09 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts