Skip to content

Commit 650ff78

Browse files
committed
Create separate index.md for consumption by pkgdown
1 parent cd25a8f commit 650ff78

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

README.Rmd

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,41 @@ knitr::opts_chunk$set(
2121
comment = "#>",
2222
fig.path = "README-"
2323
)
24+
25+
clean_output <- function(x, options) {
26+
x <- gsub("0x[0-9a-f]+", "0xdeadbeef", x)
27+
x <- gsub("dataframe_[0-9]*_[0-9]*", " dataframe_42_42 ", x)
28+
x <- gsub("[0-9]*\\.___row_number ASC", "42.___row_number ASC", x)
29+
30+
index <- x
31+
index <- gsub("─", "-", index)
32+
index <- strsplit(paste(index, collapse = "\n"), "\n---\n")[[1]][[2]]
33+
writeLines(index, "index.md")
34+
35+
x <- gsub(
36+
'(`vignette[(]"([^"]+)"[)]`)',
37+
"[\\1](https://blob.tidyverse.org/articles/\\2.html)",
38+
x
39+
)
40+
x <- fansi::strip_sgr(x)
41+
x
42+
}
43+
44+
options(
45+
cli.num_colors = 256,
46+
cli.width = 71,
47+
width = 71,
48+
pillar.bold = TRUE,
49+
pillar.max_title_chars = 5,
50+
pillar.min_title_chars = 5,
51+
pillar.max_footer_lines = 12,
52+
conflicts.policy = list(warn = FALSE)
53+
)
54+
55+
local({
56+
hook_source <- knitr::knit_hooks$get("document")
57+
knitr::knit_hooks$set(document = clean_output)
58+
})
2459
```
2560

2661
# blob

0 commit comments

Comments
 (0)