---
title: "diff in rmd"
author: "tc"
date: "2018/07/02 (updated: `r Sys.Date()`)"
output: html_document

---

```{r setup, include=FALSE}
options(htmltools.dir.version = FALSE)

# options(
#   digits=2, diffobj.pager="off", crayon.enabled=TRUE,
#   diffobj.format="html", diffobj.disp.width=120,
#   diffobj.ignore.white.space=TRUE
# )
```

# diff


<style type='text/css'>
/* Structural CSS ------------------------------------------------------------*/
/*
 * TBD whether we want a more fully table like structure; some of the visual
 * cues provided by the current set-up are useful (line wraps, etc.)
 */

DIV.diffobj_container PRE {
  white-space: pre-wrap;
  margin: 0;
}
DIV.diffobj_container DIV.row {
  width: 100%;
  font-family: monospace;
  display: table;
  table-layout: fixed;
}
DIV.diffobj_container DIV.line {
  width: auto;
  display: table-cell;
  overflow: hidden;
}
DIV.diffobj_container DIV.line>DIV {
  width: 100%;
  display: table;
  table-layout: auto;
}
DIV.diffobj_container DIV.line.banner>DIV {
  display: table;
  table-layout: auto; /* set to fixed in JS */
}
DIV.diffobj_container DIV.text {
  display: table-cell;
  width: 100%;
}
DIV.diffobj_container DIV.gutter {
  display: table-cell;
  padding: 0 0.2em;
}
DIV.diffobj_container DIV.gutter DIV {
  display: table-cell;
}
#diffobj_content_meta DIV.diffobj_container DIV.row {
  width: auto;
}
#diffobj_banner_meta DIV.diffobj_container DIV.line.banner>DIV {
  table-layout: auto;
}
#diffobj_outer {
  overflow: hidden;
}
/* Summary -------------------------------------------------------------------*/ 

DIV.diffobj_container DIV.summary DIV.map {
  word-wrap: break-word;
  padding-left: 1em;
}
DIV.diffobj_container DIV.summary DIV.detail {
  padding-left: 1em;
}

/* Common elements -----------------------------------------------------------*/

DIV.diffobj_container DIV.line.banner {
  font-size: 1.2em;
  font-weight: bold;
  overflow: hidden;
}
/* truncate banners */
DIV.diffobj_container DIV.line.banner DIV.text DIV{
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;             /* need to compute and set in JS */
}
DIV.diffobj_container DIV.gutter,
DIV.diffobj_container DIV.guide,
DIV.diffobj_container DIV.fill,
DIV.diffobj_container DIV.context_sep,
DIV.diffobj_container SPAN.trim {
  color: #999;
}
DIV.diffobj_container DIV.header {
  font-size: 1.1em;
}
DIV.diffobj_container DIV.text>DIV.match,
DIV.diffobj_container DIV.text>DIV.guide {
  background-color: #ffffff;
}
DIV.diffobj_container DIV.text>DIV.fill {
  background-color: transparent;
}
DIV.diffobj_container DIV.text>DIV {
  padding-right: 3px;
}
DIV.diffobj_container DIV.text>DIV {
  border-left: 1px solid #888888;
}
DIV.diffobj_container DIV.line {
  background-color: #eeeeee;
}
DIV.diffobj_container DIV.text>DIV,
DIV.diffobj_container DIV.header {
  padding-left: 0.5em;
}
DIV.diffobj_container DIV.line>DIV.match,
DIV.diffobj_container DIV.line>DIV.fill,
DIV.diffobj_container DIV.line>DIV.guide {
  border-left: 1px solid #888888;
}
/* github inspired color scheme - default ------------------------------------*/

DIV.diffobj_container.light.rgb SPAN.word.insert,
DIV.diffobj_container.light.rgb DIV.line>DIV.insert {
  background-color: #a6f3a6;
}
DIV.diffobj_container.light.rgb SPAN.word.delete,
DIV.diffobj_container.light.rgb DIV.line>DIV.delete {
  background-color: #f8c2c2;
}
DIV.diffobj_container.light.rgb DIV.text>DIV.insert {
  background-color: #efffef;
}
DIV.diffobj_container.light.rgb DIV.text>DIV.insert,
DIV.diffobj_container.light.rgb DIV.line>DIV.insert {
  border-left: 1px solid #33bb33;
}
DIV.diffobj_container.light.rgb DIV.text>DIV.delete {
  background-color: #ffefef;
}
DIV.diffobj_container.light.rgb DIV.text>DIV.delete,
DIV.diffobj_container.light.rgb DIV.line>DIV.delete {
  border-left: 1px solid #cc6666;
}
DIV.diffobj_container.light.rgb DIV.header {
  background-color: #e0e6fa;
  border-left: 1px solid #9894b6;
}
/* Yellow Blue variation -----------------------------------------------------*/

DIV.diffobj_container.light.yb SPAN.word.insert,
DIV.diffobj_container.light.yb DIV.line>DIV.insert {
  background-color: #c0cfff;
}
DIV.diffobj_container.light.yb SPAN.word.delete,
DIV.diffobj_container.light.yb DIV.line>DIV.delete {
  background-color: #e7e780;
}
DIV.diffobj_container.light.yb DIV.text>DIV.insert {
  background-color: #efefff;
}
DIV.diffobj_container.light.yb DIV.text>DIV.insert,
DIV.diffobj_container.light.yb DIV.line>DIV.insert {
  border-left: 1px solid #3333bb;
}
DIV.diffobj_container.light.yb DIV.text>DIV.delete {
  background-color: #fefee5;
}
DIV.diffobj_container.light.yb DIV.text>DIV.delete,
DIV.diffobj_container.light.yb DIV.line>DIV.delete {
  border-left: 1px solid #aaaa55;
}
DIV.diffobj_container.light.yb DIV.header {
  background-color: #afafaf;
  border-left: 1px solid #e3e3e3;
  color: #e9e9e9;
}
DIV.diffobj_container.light.yb DIV.line {
  background-color: #eeeeee;
}
</style>

```{r results="asis",echo=FALSE}
library(diffobj)
a <- b <- matrix(1:100, ncol=2)
a <- a[-20,]
b <- b[-45,]
b[c(18, 44)] <- 999

diffPrint(target=a, current=b, format = "html")
```

