🚀 DAY 5 OF LAUNCH WEEK: Introducing Socket Firewall Enterprise.Learn more →
Socket
Book a DemoInstallSign in
Socket

@code-blocks/rehype-transform

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@code-blocks/rehype-transform

A rehype transform to render code blocks

latest
Source
npmnpm
Version
0.1.10
Version published
Maintainers
1
Created
Source

@code-blocks/rehype-transform

A rehype transform to render code blocks

Usage

Install the transform:

npm install @code-blocks/rehype-transform --save

Install the renderers you need, for example:

npm install @code-blocks/charts --save

An use it:

const unified = require('unified')
const stream = require('unified-stream')
const markdown = require('remark-parse')
const remark2rehype = require('remark-rehype')
const html = require('rehype-stringify')

// the rehype transform
const codeblocks = require('@code-blocks/rehype-transform')

// some renderers
const charts = require('@code-blocks/charts')
const graphviz = require('@code-blocks/graphviz')

const processor = unified()
  .use(markdown)
  .use(remark2rehype)
  // add the transform and the renderers in an array as options
  .use(codeblocks, [charts, graphviz])
  .use(html)

process.stdin.pipe(stream(processor)).pipe(process.stdout)

Available renderers:

  • @code-blocks/charts
  • @code-blocks/graphviz
  • @code-blocks/math
  • @code-blocks/music
  • @code-blocks/tables
  • @code-blocks/prism

FAQs

Package last updated on 07 Aug 2021

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