3.1.0 • Published 2 months ago

docusaurus-plugin-content-gists v3.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

Docusaurus gists plugin

Use gists as a type of content in Docusaurus.

Introduction

This plugin adds a page to your Docusaurus instance, displaying all public gists of a GitHub user.

The user is automatically configured based on the (GitHub PAT) token provided.

See it in action on Takken.io.

Setup

Install dependencies

Choose one:

# NPM
npm install dotenv docusaurus-plugin-content-gists

# Yarn
yarn add dotenv docusaurus-plugin-content-gists

Configure

.gitignore

.env

.env

GITHUB_PERSONAL_ACCESS_TOKEN=ghp_your_token_here

docusaurus.config.js

// Import variables from both system and .env file.
require('dotenv').config()

const config = {
  // Configure plugin
  plugins: [
    [
      'docusaurus-plugin-content-gists',
      {
        enabled: true,
        verbose: true,
        personalAccessToken: process.env.GITHUB_PERSONAL_ACCESS_TOKEN,
      },
    ],
  ],

  // Configure navbar
  themeConfig: {
    navbar: {
      items: [{ to: '/gists', label: 'Gists', position: 'left' }],
    },
  },
}

Options

personalAccessToken

Personal access token of the user of whom to get the gists.

Important: We recommend you use an environment variable like GITHUB_PERSONAL_ACCESS_TOKEN.

That way you do not risk accidentally exposing access to your GitHub account.

required: true

enabled

Whether or not this plugin is enabled.

required: false default: true

verbose

Gives output about retrieving the gists during build time

required: false default: false

gistPageComponent

Which component to use for showing the gist page.

required: false default: '@theme/GistPage'

gistListPageComponent

Which component to use for showing the gists list page.

required: false default: '@theme/GistListPage''

Contributing

Contributions are welcome!

Please read the contributing guide.

License

MIT licensed.