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

@gridsome/remark-prismjs

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@gridsome/remark-prismjs

Syntax highlighter for markdown code blocks

  • 0.4.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
132
increased by97.01%
Maintainers
1
Weekly downloads
 
Created
Source

@gridsome/remark-prismjs

Syntax highlighter for markdown code blocks

Install

  • yarn add @gridsome/remark-prismjs
  • npm install @gridsome/remark-prismjs

Usage

In your main.js file, import a Prism CSS theme:

import 'prismjs/themes/prism.css'

export default function (Vue) {
  // ...
}

In gridsome.config.js, add syntax highlighter to a single markdown source:

module.exports = {
  plugins: [
    {
      use: '@gridsome/source-filesystem',
      options: {
        path: 'blog/**/*.md',
        route: '/blog/:year/:month/:day/:slug',
        remark: {
          plugins: [
            '@gridsome/remark-prismjs'
          ]
        }
      }
    }
  ]
}

Or add syntax highlighter to all markdown sources:

module.exports = {
  plugins: [
    {
      use: '@gridsome/source-filesystem',
      options: {}
    }
  ],

  transformers: {
    remark: {
      plugins: [
        '@gridsome/remark-prismjs'
      ]
    }
  }
}

Options

transformInlineCode
  • Type: Boolean
  • Default: false

If you'd like to disable highlighting of inline code blocks, pass transformInlineCode: false in the plugin options

showLineNumbers
  • Type: Boolean
  • Default: false

If you'd like to add line numbers alongside the code. You can pass showLineNumbers: true in the plugin options and import a Prism CSS about line numbers to main.js file. like this:

import 'prismjs/themes/prism.css'
// Prism default CSS about line numbers
import 'prismjs/plugins/line-numbers/prism-line-numbers.css'

export default function (Vue) {
  // ...
}

If you wish to only show line numbers on certain code blocks, you can leave false and use the { lineNumbers: true } syntax below

Keywords

FAQs

Package last updated on 20 Aug 2020

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