Unified View
Standard line-by-line diff with syntax highlighting.
component.go go
| + | // Render returns a string |
| + | func Render(name string) string { |
| + | return "Hello " + name |
| - | func Render() string { |
| - | return "Hello" |
} |
Side-by-Side View
Compare changes horizontally with Mode: "split".
app.js javascript
import { logger } from './utils'; | |
const x = 42; | |
logger.info(x); | |
const x = 10; | |
console.log(x); |
Usage
@display.DiffViewer(display.DiffViewerProps{
Mode: "split", // "unified" | "split"
Language: "go", // for syntax highlighting
Files: []display.DiffFile{
display.SimpleDiff("old.go", "new.go", old, new),
},
})