Skip to content

Commit

Permalink
reconfigure docs for pkgdown
Browse files Browse the repository at this point in the history
  • Loading branch information
coolbutuseless committed May 26, 2024
1 parent 6138c6e commit 73885e6
Show file tree
Hide file tree
Showing 12 changed files with 31 additions and 30 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
^\.github$
^LICENSE\.md$
^.devcontainer$
^man/figures$
38 changes: 19 additions & 19 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ output: github_document
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "data-raw/figures/README-",
fig.path = "man/figures/README-",
out.width = "100%"
)
Expand All @@ -33,7 +33,7 @@ if (FALSE) {


```{r echo = FALSE, eval = FALSE}
img <- image_read("data-raw/figures/white.png")
img <- image_read("man/figures/white.png")
hexSticker::sticker(subplot = img,
Expand All @@ -50,9 +50,9 @@ hexSticker::sticker(subplot = img,
h_size = 1.2,
h_fill = "#ffffff",
h_color = "#223344",
filename = "data-raw/figures/logo.png")
filename = "man/figures/logo.png")
image_read("data-raw/figures/logo.png")
image_read("man/figures/logo.png")
```


Expand Down Expand Up @@ -87,7 +87,7 @@ This highlighting works

<details open>
<summary style="font-size: large;">Click here to show/hide gif demo</summary>
<img src="data-raw/figures/examples.gif"/>
<img src="man/figures/examples.gif"/>
</details>

#### What's in the box
Expand Down Expand Up @@ -152,10 +152,10 @@ mtcars |>
head(15) |>
hl(c('red', 'white', 'blue')) |>
as_svg(650, 350) |>
cat(file = "data-raw/figures/example1.svg")
cat(file = "man/figures/example1.svg")
```

<img src="data-raw/figures/example1.svg" width="100%">
<img src="man/figures/example1.svg" width="100%">


#### Complex example
Expand Down Expand Up @@ -193,10 +193,10 @@ mtcars |>
) |>
hl('hotpink', rows = hp == min(hp), cols = hp:carb) |>
as_svg(650, 380) |>
cat(file = "data-raw/figures/example2.svg")
cat(file = "man/figures/example2.svg")
```

<img src="data-raw/figures/example2.svg" width="100%">
<img src="man/figures/example2.svg" width="100%">



Expand All @@ -218,10 +218,10 @@ x <- "Paris in the the spring?"
y <- "Not Paris in the spring!"
hl_diff(x, y) |>
as_svg(600, 80) |>
cat(file = "data-raw/figures/example-strdiff-3.svg")
cat(file = "man/figures/example-strdiff-3.svg")
```

<img src="data-raw/figures/example-strdiff-3.svg" width="100%">
<img src="man/figures/example-strdiff-3.svg" width="100%">

Levenshtein's edit distance naturally applies to strings, but `hl_diff()` can
visualise the difference between arbitrary objects by first converting them
Expand All @@ -238,10 +238,10 @@ hl_diff(mean, median, coerce = 'print', sep = " ")
```{r echo=FALSE}
hl_diff(mean, median, coerce = 'print', sep = " ") |>
as_svg(600, 200) |>
cat(file = "data-raw/figures/example-strdiff-4.svg")
cat(file = "man/figures/example-strdiff-4.svg")
```

<img src="data-raw/figures/example-strdiff-4.svg" width="100%">
<img src="man/figures/example-strdiff-4.svg" width="100%">

## Highlight regular expression matches in objects with `hl_grep()`

Expand Down Expand Up @@ -271,10 +271,10 @@ that Royal would have found the event to be most satisfactory.
[Chas, now wearing a black Adidas tracksuit, nods to his sons]"
hl_grep(txt, "event.*satisfactory", coerce = 'character')|>
as_svg(600, 200) |>
cat(file = "data-raw/figures/example-hlgrep-1.svg")
cat(file = "man/figures/example-hlgrep-1.svg")
```

<img src="data-raw/figures/example-hlgrep-1.svg" width="100%">
<img src="man/figures/example-hlgrep-1.svg" width="100%">

#### Highlight regular expression matches within an object

Expand All @@ -291,10 +291,10 @@ hl_grep(mode, 'switch')
```{r echo = FALSE}
hl_grep(mode, 'switch') |>
as_svg(600, 250) |>
cat(file = "data-raw/figures/example-hlgrep-2.svg")
cat(file = "man/figures/example-hlgrep-2.svg")
```

<img src="data-raw/figures/example-hlgrep-2.svg" width="100%">
<img src="man/figures/example-hlgrep-2.svg" width="100%">


# Animated SVG
Expand Down Expand Up @@ -322,11 +322,11 @@ objs <- list(
svg <- as_svg_anim(objs, width = 600, height = 100, duration = 2,
playback = 'infinite', font_size = "2em")
writeLines(svg, "data-raw/figures/example-svg-anim.svg")
writeLines(svg, "man/figures/example-svg-anim.svg")
```


<img src="data-raw/figures/example-svg-anim.svg">
<img src="man/figures/example-svg-anim.svg">



Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ This highlighting works
<summary style="font-size: large;">
Click here to show/hide gif demo
</summary>
<img src="data-raw/figures/examples.gif"/>
<img src="man/figures/examples.gif"/>
</details>

#### What’s in the box
Expand Down Expand Up @@ -100,7 +100,7 @@ mtcars |>
hl(c('red', 'white', 'blue'))
```

<img src="data-raw/figures/example1.svg" width="100%">
<img src="man/figures/example1.svg" width="100%">

#### Complex example

Expand All @@ -125,7 +125,7 @@ mtcars |>
)
```

<img src="data-raw/figures/example2.svg" width="100%">
<img src="man/figures/example2.svg" width="100%">

## Highlight difference between two objects with `hl_diff()`

Expand All @@ -139,7 +139,7 @@ y <- "Not Paris in the spring!"
hl_diff(x, y)
```

<img src="data-raw/figures/example-strdiff-3.svg" width="100%">
<img src="man/figures/example-strdiff-3.svg" width="100%">

Levenshtein’s edit distance naturally applies to strings, but
`hl_diff()` can visualise the difference between arbitrary objects by
Expand All @@ -154,7 +154,7 @@ function definitions is highlighted.
hl_diff(mean, median, coerce = 'print', sep = " ")
```

<img src="data-raw/figures/example-strdiff-4.svg" width="100%">
<img src="man/figures/example-strdiff-4.svg" width="100%">

## Highlight regular expression matches in objects with `hl_grep()`

Expand All @@ -174,7 +174,7 @@ that Royal would have found the event to be most satisfactory.
hl_grep(txt, "event.*satisfactory", coerce = 'character')
```

<img src="data-raw/figures/example-hlgrep-1.svg" width="100%">
<img src="man/figures/example-hlgrep-1.svg" width="100%">

#### Highlight regular expression matches within an object

Expand All @@ -189,7 +189,7 @@ In this example, the function body for `mode()` is searched for the word
hl_grep(mode, 'switch')
```

<img src="data-raw/figures/example-hlgrep-2.svg" width="100%">
<img src="man/figures/example-hlgrep-2.svg" width="100%">

# Animated SVG

Expand All @@ -206,7 +206,7 @@ svg <- as_svg_anim(objs, width = 600, height = 300, duration = 2,
playback = 'infinite', font_size = "2em")
```

<img src="data-raw/figures/example-svg-anim.svg">
<img src="man/figures/example-svg-anim.svg">

## Options

Expand Down
File renamed without changes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes

0 comments on commit 73885e6

Please sign in to comment.