hhsnopek / code-frame

Minimal Code Frame like babel-code-frame, but smaller
MIT License
23 stars 4 forks source link

Support line number #6

Closed tamascsaba closed 7 years ago

tamascsaba commented 8 years ago
const framer = require('code-frame')

// framer(input, line[, col])
// input - string
// line  - int
// col   - int (optional)
// lineNumber   - int (optional) min 3

framer('console.log('bar')\n\nfunction (foo)\n{\tconsole.log(foo\n}\n', 2, 15, 5)
//   1. |  console.log('bar')
//   2. |
// > 3. | function (foo)
//      |                ^
//   4. | console.log('foo')
//   5. | 
hhsnopek commented 8 years ago

The current way of generating our returning string is by manually pushing strings into an array. For this to be possible we'd have to change that functionality. I'm open to new ways to generate the string if you'd like to take a stab at it. 😀

hhsnopek commented 8 years ago

Hey @tamascsaba I didn't want to leave you hanging here, over in #13 there's a small discussion about this. I forgot to back reference here for you, sorry about that!

tamascsaba commented 8 years ago

@hhsnopek thx :+1: