0.5.1 • Published 5 years ago

futoji v0.5.1

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

futoji

a simple open/close text transformer

Example Usage

import Formatter from 'futoji'
let futoji = new Formatter()

futoji.addTransformer({
  name: 'bold', 
  symbol: '**',
  transformer: text => `<strong>${text}</strong>`
})

futoji.addTransformer({
  name: 'italic', 
  symbol: '*',
  transformer: text => `<em>${text}</em>`
})

let formatted = futoji.format(`
  normal text
  *italic text*
  **bold text**
  **bold *italic* bold**
  *italic **bold** italic*
`)
// becomes
/*

  normal text
  <em>italic text</em>
  <strong>bold<em>italic</em>bold</strong>
  <em>italic <strong>bold</strong> italic</em>

*/

Example with open and close

futoji.addTransformer({
  name: 'green',
  open: '>',
  close: '\n'
  transformer: text => (`<span class="green">${text}</span>`)
})

futoji.format(`
  > thing
  normal
  > greeeeen
  > stuff
  normal also
`)
// becomes
/*

  <span class="green"> thing</span>
  normal
  <span class="green"> greeeeen</span>
  <span class="green"> stuff</span>
  normal also

*/
0.5.1

5 years ago

0.5.0

5 years ago

0.4.0

5 years ago

0.3.0

5 years ago

0.2.6

5 years ago

0.2.4

5 years ago

0.2.3

5 years ago

0.2.2

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago