defence

extract fenced code from CommonMark documents

MIT 10 个版本
安装
npm install defence
yarn add defence
pnpm add defence
bun add defence
README

The package exports a single function.

The function's first argument is a string of CommonMark markup.

The function's second, optional, argument is an array of strings. Each string is a fenced code block infostring or the empty string signifying no infostring.

The function returns a string equal to its first argument, but with all content outside of fenced code blocks filtered out. If a second argument was passed, only content in fenced code blocks with matching passed infostrings is retained. In this way, fenced code block content appears on the same line in the output as it did in the input.

版本列表
3.0.1 2019-04-14
3.0.0 2019-04-14
2.0.1 2016-08-27
2.0.0 2016-04-29
1.0.5 2016-02-17
1.0.4 2015-12-16
1.0.3 2015-11-29
1.0.2 2015-08-01
1.0.1 2015-08-01
1.0.0 2015-08-01