This repository was archived by the owner on Oct 26, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathrender_html.R
More file actions
24 lines (22 loc) · 1.33 KB
/
render_html.R
File metadata and controls
24 lines (22 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# Todo: can we just get a nice simple light theme?
library(rmarkdown)
render("readme.md", html_document(self_contained = FALSE, mathjax = NULL, highlight = 'pygments'))
txt <- readLines('readme.html')
txt <- sub('<title>.*</title>', '<title>Using Rtools40 on Windows</title>', txt)
txt <- sub('readme_files/bootstrap-([.0-9]+)/css/bootstrap.min.css', 'https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/\\1//css/bootstrap.min.css', txt)
txt <- sub('https://cran.r-project.org/bin/windows/Rtools/', '', txt, fixed = TRUE)
txt <- sub('.*<script src="readme_files.*', "", txt)
writeLines(txt, 'readme.html')
browseURL('readme.html')
# Alternative style
library(rmarkdown)
render("readme.md", html_document(self_contained = F, mathjax = NULL, highlight = 'haddock',
theme = NULL, includes = includes('style.inc')), 'cranstyle.html')
txt <- readLines('cranstyle.html')
txt <- sub('<title>.*</title>', '<title>Using Rtools4 on Windows</title>', txt)
txt <- sub('.*<script src=".*', "", txt)
txt <- sub('<a href="https://github.com', '<a target="_top" href="https://github.com', fixed = TRUE, txt)
txt <- sub('<a href="https://www.msys2.org', '<a target="_top" href="https://www.msys2.org', fixed = TRUE, txt)
txt <- sub('https://cran.r-project.org/bin/windows/Rtools/', '', txt, fixed = TRUE)
writeLines(txt, 'cranstyle.html')
browseURL('cranstyle.html')