chipa
Easily extract code snippets from Markdown files.
Installation
$ yarn add chipa
$ npm install --save chipa
Usage
Position :: { start: { column: Int, line: Int } }
Snippet :: { lang: String, meta: String, value: String, position: Position }
FileResult :: { file: String, lang: String, snippets: [Snippet] }
extractSingle :: String -> String?|[String]? -> Promise(FileResult)
extractSingle(filePath: String, language?: String|[String])
const { extractSingle } = require('chipa')
extractSingle('README.md', ['js', 'javascript'])
.then((result) => {
})
extract :: String -> String?|[String]? -> Promise([FileResult])
extract(glob: String, language?: String|[String])
const { extract } = require('chipa')
extract('docs/*.md', 'go')
.then((files) => {
})