@singapore-editor/diff
v0.2.15
Published
Stacked and split diffs with inline changes for the Singapore editor.
Maintainers
Readme
@singapore-editor/diff
Stacked and split diffs with inline changes for the Singapore editor.
Part of Singapore. A code editor for the browser that keeps every version.
Install
npm install @singapore-editor/core @singapore-editor/diffUsage
Compare two versions and project the changed rows. Use createDiffPlugin() to render them in an editor.
import { createStackedProjection, createTextDiff, joinRenderLines } from '@singapore-editor/diff'
const file = createTextDiff({
oldFile: { path: 'note.ts', text: 'const value = 1\n' },
newFile: { path: 'note.ts', text: 'const value = 2\n' },
})
const projection = createStackedProjection(file)
console.log(joinRenderLines(projection.rows))API highlights
createTextDiff()compares two file versions.createDiffPlugin()projects stacked or split rows.parseGitPatch()reads a Git patch.
In the Singapore family
@singapore-editor/core owns the editor view. Add this plugin to display changes between two file versions.
Singapore README · Documentation
License
MIT. License
