{"id":25806027,"url":"https://github.com/alipsa/htmlcreator","last_synced_at":"2026-06-12T00:31:32.917Z","repository":{"id":57742897,"uuid":"308943375","full_name":"Alipsa/htmlcreator","owner":"Alipsa","description":"R package to create html for Renjin ","archived":false,"fork":false,"pushed_at":"2022-03-06T16:54:47.000Z","size":60,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-18T07:41:13.052Z","etag":null,"topics":["r-package","renjin"],"latest_commit_sha":null,"homepage":"","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Alipsa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":["Alipsa"]}},"created_at":"2020-10-31T18:06:30.000Z","updated_at":"2022-02-16T20:01:02.000Z","dependencies_parsed_at":"2022-09-11T09:41:24.622Z","dependency_job_id":null,"html_url":"https://github.com/Alipsa/htmlcreator","commit_stats":null,"previous_names":["pernyfelt/htmlcreator"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/Alipsa/htmlcreator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alipsa%2Fhtmlcreator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alipsa%2Fhtmlcreator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alipsa%2Fhtmlcreator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alipsa%2Fhtmlcreator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Alipsa","download_url":"https://codeload.github.com/Alipsa/htmlcreator/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alipsa%2Fhtmlcreator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34224103,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-11T02:00:06.485Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["r-package","renjin"],"created_at":"2025-02-27T19:52:44.278Z","updated_at":"2026-06-12T00:31:32.880Z","avatar_url":"https://github.com/Alipsa.png","language":"R","funding_links":["https://github.com/sponsors/Alipsa"],"categories":[],"sub_categories":[],"readme":"# Renjin html creator\nRenjin R package to create html  \n\nThis package provides a simple way to create html content.\nHere is an example:\n```r\n  library('se.alipsa:htmlcreator')\n\n  html.new(\"\u003chtml\u003e\u003cbody\u003e\")\n  html.add(\"\u003ch2\u003eA Sample report with a table and an image\u003c/h2\u003e\")\n  html.addPlot(\n    {\n      plot(mtcars$mpg ~ mtcars$hp, pch=23, col=\"orange\", bg=\"orange\", cex=1.5, lwd=2)\n      abline(h = mean(mtcars$mpg), col=\"green\")\n    }, \n    width=300, \n    height=400, \n    htmlattr=list(alt=\"mtcars mpg ~ hp\", id=\"plot1\")\n  )\n  html.add(mtcars)\n  html.add(\"\u003c/html\u003e\u003c/body\u003e\")\n  # save the html to a file\n  outFile \u003c- tempfile(\"plot\", fileext = \".html\")\n  write(html.content(), outFile)\n  print(paste(\"Wrote\", outFile))\n```\nTo be able to do this, add the dependency to your pom.xml as follows:\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003ese.alipsa\u003c/groupId\u003e\n  \u003cartifactId\u003ehtmlcreator\u003c/artifactId\u003e\n  \u003cversion\u003e1.4.1\u003c/version\u003e\n\u003c/dependency\u003e\n```\nAs you can see, the main method is the overloaded `html.add`. It can take\n1. strings (charvectors) as parameters (which are treated as raw html),\n2. a data.frame (which is converted into a html table), \nor \n3. a plot function (which converts the plot into an img tag). Notice that the plot function is passed in enclosed\nwith `{ }`, this to allow the plot function to be executed by the html.addPlot method (which converts the result of the plot to an image and\nbase64 encodes it into a string which is then made part of the img tag) rather than executed before the function is called.\n\nIn addition to `html.add(x,...)` and `html.addPlot(x, ...)`, there is the `html.clear()` function which resets the \nunderlying html object (clears the content). The `html.new(x, ...)` is an alias for `html.clear()` \nfollowed by `html.add(x,...)` and is a good way to start the script \n(especially if you run multiple scripts in the same session).\n\nhtml attributes can be set by setting the parameter `htmlattr` to a list of attribute, e.g:\n```r\n# add id and class to a table:\nhtml.add(mtcars, htmlattr=list(id=\"cardetails\", class=\"table table-striped\"))\n\n# add alt attribute to an img:\nhtml.addPlot({\n  plot(\n    cars,\n    main=\"Cars speed and dist\",\n    col=c(\"darkblue\")\n  )\n  abline(h = mean(cars$dist), col=\"red\")\n  abline(v = mean(cars$speed), col=\"red\")\n  },\n  htmlattr = list(alt=\"a cars plot\")\n)\n```\n\nIt is also possible to use the underlying reference class (Html) and the specific\nhtml creating methods directly. The underlying html creating methods are:\n- html.table - converts a data.frame to a table\n- html.imgPlot - converts a plot to an img tag\n- html.imgPlotComplex - converts a series of plot commands enclosed with `{ }` to an img tag\n- html.imgFile - converts a file to an img tag\n- html.imgUrl - creates an img tag\n\n# Version history\n\n## 1.4.2\n\n## 1.4.1\n- upgrade maven enforcer plugin\n- Add addPlot function for better plotting capabilities\n- Make sure get content is enclosed in `\u003chtml\u003e \u003c/html\u003e`\n\n## 1.4\n- add html.new(...) as an alias for html.clear() followed by html.add(...)\n- fix broken tests\n\n## 1.3\n- use a dedicated env to avoid accidental overwrites\n- Remove space in base 64 file encoding (no space works in all browsers whereas the space caused problems in (at least) Firefox)\n\n## 1.2\n- Fixes to img handling, rename internal functions for clarity\n\n## 1.1\n- bugfix for matrix's\n- add ability to add element attributes (e.g class, id etc)\n\n## 1.0 initial release","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falipsa%2Fhtmlcreator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falipsa%2Fhtmlcreator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falipsa%2Fhtmlcreator/lists"}