0.2.0 • Published 8 years ago

jade-code-block v0.2.0

Weekly downloads
1
License
ISC
Repository
github
Last release
8 years ago

Jade code block

Get Jade code at and inside a given line or query.

doc.jade

doctype html
html
  head
    title my jade template
  body
    h1 Hello #{name}
    p foo

Get block at line number

var source = fs.readFileSync('./doc.jade', 'utf8');

var getCodeBlock = require('jade-code-block');
getCodeBlock.byLine(source, 3);

// head
//   title my jade template

Get block at string match

Will return a string for a single match, an array of code blocks when multiple matches are found.

var source = fs.readFileSync('./doc.jade', 'utf8');

var getCodeBlock = require('jade-code-block');
getCodeBlock.byString(source, 'body');

// body
//   h1 Hello #{name}
//   p foo

Get block after block at line

var source = fs.readFileSync('./doc.jade', 'utf8');

var getCodeBlock = require('jade-code-block');
getCodeBlock.afterBlockAtLine(source, 3);

//  body
//    h1 Hello #{name}
//    p foo

Get block before block at line

var source = fs.readFileSync('./doc.jade', 'utf8');

var getCodeBlock = require('jade-code-block');
getCodeBlock.beforeBlockAtLine(source, 5);

//  head
//    title my jade template
0.2.0

8 years ago

0.1.6

9 years ago

0.1.5

9 years ago

0.1.4

9 years ago

0.1.3

9 years ago

0.1.2

9 years ago

0.1.1

9 years ago

0.1.0

9 years ago