Code Monkey home page Code Monkey logo

Comments (11)

timelyportfolio avatar timelyportfolio commented on July 18, 2024

How do you want this to look? Do you want it to be like the handsontable implementation on paulfitz.github.io/daff? I think this would be a good start and happy to start putting together.

from daff.

timelyportfolio avatar timelyportfolio commented on July 18, 2024

The other project I have been experimenting with heavily is https://github.com/benjamine/jsondiffpatch.

from daff.

edwindj avatar edwindj commented on July 18, 2024

Seems fine to me to start with the implementation of daff (note that render_diff does exactly that).
For a later version I may be nice to use bootstrap3 css style, so it integrates nicely with shiny/rmarkdown.

from daff.

edwindj avatar edwindj commented on July 18, 2024

I was not familiar with this project (https://github.com/benjamine/jsondiffpatch), looks nice!

from daff.

timelyportfolio avatar timelyportfolio commented on July 18, 2024

Aim of the projects is similar, but jsondiffpatch more focused on non-tabular. What is nice about jsondiffpatch is the built in html renderer, so making a htmlwidget is much easier.

from daff.

timelyportfolio avatar timelyportfolio commented on July 18, 2024

Just wanted to circle back to this. There are lots of easy improvements without even a full htmlwidget implementation. I think a full implementation would be nice, but for now I'll submit a pull with the simple change. Sorry it has taken me so long.

from daff.

timelyportfolio avatar timelyportfolio commented on July 18, 2024

Here is the non-htmlwidget implementation https://github.com/timelyportfolio/daff/tree/feature/htmltools using just the helpful htmltools from RStudio. The quick win here is now render_diff will show up in rmarkdown documents, which I demonstrated with this silly vignette.

image

Also, here is an example in Shiny.

library(shiny)
library(daff)

ui <- fluidPage( uiOutput("daff") )

server <- function(input,output,session){
  output$daff <- renderUI({
    y <- iris[1:3,]
    x <- y
    invalidateLater(1000, session)

    x[,1] <- jitter(y[,1])
    patch <- diff_data(y, x)
    render_diff(patch, fragment = F)
  })
}
shinyApp(ui,server)

I would enjoy your thoughts on this. Thanks.

from daff.

happyshows avatar happyshows commented on July 18, 2024

Hi, is there any progress on this one? I think render_diff is pretty close to the htmlwidget convention, just last mile to wrap in the standard format

from daff.

dylanbeaudette avatar dylanbeaudette commented on July 18, 2024

This is excellent work, thank you. Any progress on embedding render_diff output within an rmarkdown document?

from daff.

dylanbeaudette avatar dylanbeaudette commented on July 18, 2024

Here is my local hack to get daff chunks into rmarkdown HTML documents:

  1. add a "style.css" with a copy of the daff CSS to the YAML header
  2. wrap chunks with this function:
# temp hack to get daff chunks into an rmarkdown doc
wrapDaffHTML <- function(chunkHTML, chunkTitle) {
cat("<div class='highlighter' style='align:center; font-size:80%;'>")
cat(paste0("<h3>", chunkTitle, "</h3>"))
cat(chunkHTML)
cat("</div><br><br>")
}

I am sure there is a better way, but this seems to work OK. It would be nice to get the summary HTML chunks, but I can live without those for now.

from daff.

edwindj avatar edwindj commented on July 18, 2024

Thx for your suggestions! I will work on rendering to markdown next week.

from daff.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.