Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@saucelabs/theme-github-codeblock

Package Overview
Dependencies
Maintainers
0
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.

  • 0.3.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
429
decreased by-69.62%
Maintainers
0
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

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc