get Jade code block
npm install jade-code-block
_doc.jade_
``jade`
doctype html
html
head
title my jade template
body
h1 Hello #{name}
p foo
js
var source = fs.readFileSync('./doc.jade', 'utf8');var getCodeBlock = require('jade-code-block');
getCodeBlock.byLine(source, 3);
// head
// title my jade template
`$3
Will return a string for a single match, an array of code blocks when multiple matches are found.`js
var source = fs.readFileSync('./doc.jade', 'utf8');var getCodeBlock = require('jade-code-block');
getCodeBlock.byString(source, 'body');
// body
// h1 Hello #{name}
// p foo
`$3
`js
var source = fs.readFileSync('./doc.jade', 'utf8');var getCodeBlock = require('jade-code-block');
getCodeBlock.afterBlockAtLine(source, 3);
// body
// h1 Hello #{name}
// p foo
`$3
`js
var source = fs.readFileSync('./doc.jade', 'utf8');var getCodeBlock = require('jade-code-block');
getCodeBlock.beforeBlockAtLine(source, 5);
// head
// title my jade template
``