Description Usage Arguments Note References Examples
This function create an HTML widget to diplay a graphic view of a 'git diff' result.
1 2 3 4 |
diff |
the result of a 'git diff' |
inputFormat |
the format of the input data: 'diff' or 'json', default is 'diff' |
outputFormat |
the format of the output data: 'line-by-line' or 'side-by-side', default is 'side-by-side' |
showFiles |
boolean to display or not the header with files changed, default is FALSE |
matching |
matching level: 'lines' for matching lines, 'words' for matching lines and words or 'none', default is 'none' |
synchronisedScroll |
scroll both panes in side-by-side mode: TRUE or FALSE, default is TRUE |
matchWordsThreshold |
similarity threshold for word matching, default is 0.25 |
matchingMaxComparisons |
perform at most this much comparisons for line matching a block of changes, default is 2500 |
width |
width of the widget |
height |
height of the widget |
elementId |
ID of the widget div |
All parameters are directly send to diff2html function to be compatible with futures versions.
See https://diff2html.xyz for more informations.
1 2 3 4 5 6 7 8 9 10 11 | library(diffRgit)
#get git diff with system('git diff file1 file2", intern = TRUE) instead
l_diff <- "diff --git a/../diff2widget/file1 b/../diff2widget/file2\nindex ab63d51..eb01961 100644\n--- a/../diff2widget/file1\n+++ b/../diff2widget/file2\n@ -1,5 +1,4 @\n-hello!\n+hello world!\n Where is Bryan?\n+Bryan is in the kitchen.\n bye!\n-\n-oups!"
diffRgit(l_diff)
#see diff line by line
diffRgit(l_diff, outputFormat = 'line-by-line')
#remove header
diffRgit(l_diff, showFiles = FALSE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.