Skip to content

Commit

Permalink
feat: use katex for math
Browse files Browse the repository at this point in the history
  • Loading branch information
maelle committed Sep 16, 2024
1 parent b35b443 commit d51a610
Show file tree
Hide file tree
Showing 2 changed files with 204 additions and 0 deletions.
1 change: 1 addition & 0 deletions inst/pkgdown/_pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ template:
base_font: {google: "Roboto Condensed"}
heading_font: {google: "Playfair Display"}
code_font: {google: "Roboto Mono"}
math-rendering: katex

authors:
Poisson Consulting:
Expand Down
203 changes: 203 additions & 0 deletions vignettes/rendering.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
---
title: "Output Rendering"
subtitle: "Subtitle is skipped from the TOC"
author: "Author is skipped from the TOC"
date: "Date is skipped from the TOC"
---

```{r}
# all from https://github.com/r-lib/pkgdown/blob/bbf246ea0e115fa39486bee5be80f91903c0081b/vignettes/test/rendering.Rmd#L1
#| include: FALSE
knitr::opts_chunk$set(collapse = TRUE, comment = "#>")
```

This vignette tests pkgdown output rendering for several use cases.

## Footnotes

Yay[^footnote]

[^footnote]: Including **footnotes**! 😁

## Figures

```{r}
#| fig.alt: Test plot
plot(1:10)
```


## Details tag

<details>
This should only be shown when required
</details>

<details>
<summary>Multiple paragraphs</summary>
First paragraph

Second paragraph
</details>

<details>
<summary>Some R code</summary>

```{r}
1 + 2
```
</details>

## Tables

| col 1 | col 2 | col 3 | col 4 |
|:---------------|:-----------|:-------:|:---------:|
| Brightness | Total brightness, total reflectance, spectral intensity | $$y = x^2$$ | test |

## Math

$$f(x) = \dfrac{1}{\sqrt{2\pi\sigma^2}} e^{-\frac{(x-\mu^2)}{2\sigma^2}}$$

Inline equations: $y=x^2$

## Code

### Line width

```{r}
pkgdown:::ruler()
cat(rep("x ", 100), sep = "")
cat(rep("xy", 100), sep = "")
```

### Should be highlighted

Valid R code in `\preformatted{}`:

```
mean(a + 1)
```

R code in `R` block:

```R
mean(a + 1)
```

R code in `r` block:

```R
mean(a + 1)
```

Yaml

```yaml
yaml: [a, 1]
```
### Shouldn't be highlighted
Non-R code in `\preformatted{}`

```
yaml: [a, b, c]
```
### Crayon
```{r}
cat(cli::col_red("This is red"), "\n")
cat(cli::col_blue("This is blue\n"), "\n")
message(cli::col_green("This is green"))
warning(cli::style_bold("This is bold"))
```
Some text

```{r}
#| error: TRUE
stop(cli::style_italic("This is italic"))
```

Some more text

## Quoted text

> Single-line quote about something miscellaneous.
| Flush
| 1 space indent
| 2 space indent
| 3 space indent

## This section is unnumbered {-}

There should however be no bug here!

## Tabsets

### Tabset with pills {.tabset .tabset-pills}

#### Tab 1

blablablabla

```r
1 + 1
```

Should be "cool" heading below

##### cool

Stuff

#### Tab 2

blop

### Tabset without pills {.tabset}

#### Tab 1

something nice

```{r}
#| fig.alt: Another test plot
plot(1:42)
```

#### Tab 2 {.active}

This tab should be active

### Fading tabset {.tabset .tabset-fade}

#### English

Hello!

#### French

Bonjour!

#### German

Guten tag.

## Deep headings

### Heading 3

#### Heading 4

##### Heading 5

## Very long words

This word should be broken across multiple lines on mobile, rather than making the page scroll horizontally:

Ccccccccccccaaaaaaaaaaaaaaatttttttttttttttttssssssssssssssss

0 comments on commit d51a610

Please sign in to comment.