@code-blocks/from-md
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

@code-blocks/from-md

Extracts code blocks from markdown.

Usage

import fromMD from '@code-blocks/from-md'

fromMD(someHTML, ['line-chart', 'csv-table'])

Takes tow arguments:

  • md a string containing markdown
  • languages an array of languages to extract

Returns an array of parts:

export interface PartCode {
  type: 'code'
  language: string
  content: string
}

export interface PartOther {
  type: 'other'
  content: string
}

export type Part = PartCode | PartOther

Readme

Keywords

none

Package Sidebar

Install

npm i @code-blocks/from-md

Weekly Downloads

2

Version

0.1.0

License

GPLv2

Unpacked Size

2.56 kB

Total Files

4

Last publish

Collaborators

  • idris-maps