Skip to content

AndersDJohnson/nwdiff

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nwdiff

Generate word-level diff output between two strings like GNU wdiff. Colored (optionally) with chalk.

import nwdiff from 'nwdiff'

nwdiff('one and two', 'ne anwooo')
// === '[-o-]ne an[-d t-]wo{+oo+}' (maybe with color ANSI sequences)

// or custom options (defaults below)
nwdiff('one and two', 'ne anwooo', {
  delimiters: false, // Whether to print delimiters for start/end
  startInsert: '{+',
  endInsert: '+}',
  startDelete: '[-',
  endDelete: '-]',
  color: undefined, // Whether to use color, default auto-detected
  // These colors are `chalk` colors:
  colorContext = 'gray',
  colorInsert = 'black',
  bgColorInsert = 'bgGreenBright',
  colorDelete = 'black',
  bgColorDelete = 'bgRedBright',
  colorDelimiter = 'black',
  bgColorDelimiter = 'bgWhite'
})

About

Generate word-level diff output between two strings like GNU wdiff.

Resources

License

Stars

Watchers

Forks

Packages

No packages published