npm.io
0.0.5 • Published 7 years ago

extract-code-md

Licence
ISC
Version
0.0.5
Deps
5
Size
4 kB
Vulns
0
Weekly
0
Stars
1

extract-code-md

Extract code from markdown block code.

Usage

const extract = require('extract-code-md')

const list = extract(
  `
# head1

Works
~~~javascript
1 + 2 // => 3
~~~

DO NOT works
~~~typescript
1 + 2 // => 3
~~~
`,
  {
    languages: ['js', 'javascript']
  }
)

list.length // => 1

Options

languages

the allowed languages for extracting.

  • Type: string[]
  • Default: ['js', 'javascript']