-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
154 lines (115 loc) · 4.74 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
---
output: github_document
editor_options:
markdown:
wrap: 72
---
<!-- README.md is generated from README.Rmd. Please edit this file -->
# primermd <img src="man/figures/logo.png" width="160" align="right"/>
**`{primermd}`** is a versatile template for `{rmarkdown}` based on [Primer
CSS](http://primer.style/css/) developed by GitHub. Primer CSS is very readable,
accessible, and responsive; however, it is really not meant to be used for
a simple one-page document. That being said, I quite like it, and that's why
this package exists! I wanted to be able to get as close as I can to GitHub's
Markdown rendering, so, I went with their framework! 🙃
`{primermd}` is, by design, not very customizable, in fact, I have intentionally
removed some basic options that you can find in similar template packages,
e.g., prismjs syntax highlight, Font Awesome. As said, my main goal is to
replicate GitHub's Markdown rendering, and add some of the features that they
are adding to their website, e.g., check boxes, alerts, etc.
In the future, if I have some time, I would like to continue tweaking this, and
keeping it up to date with GitHub's changes, and aesthetic.
![](man/figures/comparison.png)
## Installation
You can install the latest development version from
[GitHub](https://github.com/amirmasoudabdol/primermd/):
``` r
remotes::install_github("amirmasoudabdol/primermd")
```
and, hopefully **soon**, you can install the released version of primermd from CRAN:
``` r
# ⚠️ Not Working Yet!
install.packages("primermd")
```
## Usage
You may activate the `{primermd}` theme by adding the following line to
the top of your R Markdown file.
``` yaml
output:
primermd::html_document_primer
```
## Customizations
{primermd} offers a few customization options and features, e.g., theme,
title customization. You can tweak the behavior, and looks of the theme
by adding more parameters to your YAML header as described below.
### Themes
Primer CSS automatically adjusts to user's system settings, and it
delivers either light, or dark theme of the page accordingly based on
the current appearance of the system. If you wish to disable this
automatic behavior, you may set the `auto_theme` variable to `false`,
and as a result adaptive theme-ing will be disabled.
In addition to default `light` and `dark` themes, you can choose two
darker themes, i.e., `dark_dimmed`, `dark_high_contrast`. You can select
either of these themes using `light_theme` and `dark_theme` parameters.
``` yaml
output:
primermd::html_document_primer:
auto_theme: true
light_theme: light
dark_theme: dark_dimmed
```
> ⚠️ At the moment, RStudio does not adapt to user preferences and therefore
{primermd} does not work as expcted inside the RStudio. However, if you open the
generated file in your browser you'll get the adaptive behavior.
### Title Customization
By default, {primermd} adds the title, subtitle, author and the date to
the top of the document; however, you can disable this by setting the
`header` parameter to `false`.
``` yaml
output:
primermd::html_document_primer:
header: false
```
### Footer Customization
By default, the footer of the page contains the authors names', but
it is possible to hide the footer entirely by setting the `footer`
parameter to `false`.
``` yaml
output:
primermd::html_document_primer:
footer: false
```
### List Style
By setting the `list_style_none` parameter to `true`, you can remove bullets
from an unordered list or numbers from an ordered list.
``` yaml
output:
primermd::html_document_primer:
list_style: none
```
### Enable the Checkboxes
By setting the `enable_checkboxes` parameter to `true`, you can enable the
check box controls such that readers can interact with them.
``` yaml
output:
primermd::html_document_primer:
enable_checkboxes: true
```
### Syntax Highlight
By setting the `highlight` to `false`, you can disable the syntax highlighting.
{primermd} does not allow you to change the color scheme of the code
highlighter. I'm working on enabling this, but it is a bit tricky because I want
to have a list of schemes that look good with all the settings.
## Todos
- [ ] Make it possible to change the width of the page
- [ ] Make use of [Octicons](https://primer.style/octicons/), replacing the
Font Awesome
- [ ] Add `use_primermd()`
- [ ] Find a matching color scheme for syntax highlighting
- [x] Make sure that the table of content looks alright
## Acknowledgments
I should thank [Garrick](https://github.com/gadenbuie) for his awesome R
Markdown themes, [cleanmd](https://github.com/gadenbuie/cleanrmd). I wanted to
make this theme for a while, but I had no time, and inspiration to start it. His
project motivated me to work on this project. Oh, and I could not have done it
without his code. Thanks!