rich-text-diff
v0.2.3
Published
Visualize differences in rich text (Markdown)
Downloads
7,028
Readme
Rich Text Visual Difference
Now with Markdown™®! (Always with Markdown?)
Getting Started
Installation
npm i --save rich-text-diff
Usage
const diff = require('rich-text-diff')
const str1 = `
# Some crazy markdown.
It's the best.
- List Item 1
- List Item 2
- List Item 3
`
const str2 = `
# Some completely sane markdown.
It's ok I guess.
- List Item 1
- List Item 3
`
diff(str1, str2)
/*
* RETURNS:
* # Some <del>crazy</del><ins>completely</ins> <ins>sane </ins>markdown.
*
* It's <del>the</del><ins>ok</ins> <del>best</del><ins>I guess</ins>.
*
* - List Item 1
* - <del>List Item 2</del>
* - List Item 3
*/
Just add your favorite Markdown parser and WHAMO! You have yourself a spicy rich text diffing sandwich.