-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
88 lines (63 loc) · 2.81 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
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# aeolus
<!-- badges: start -->
[![R-CMD-check](https://github.com/maelle/aeolus/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/maelle/aeolus/actions/workflows/R-CMD-check.yaml)
[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)
<!-- badges: end -->
The goal of aeolus is to fix Markdown files that have no semantic linebreaks.
aEOLus, get it? :wink:
## Installation
You can install the development version of aeolus like so:
``` r
pak::pak("ropenscilabs/aeolus")
```
## Why have semantic linebreaks?
For any Markdown parser the two following code chunks are the same:
```md
This is a sentence. This is another
sentence.
```
```md
This is a sentence.
This is another sentence.
```
However, the second one will make your work easier when you use version control.
Git treats code by **line** so if lines are logical units as opposed to random units
or units of a certain length,
the Git diff is better.
If you change one sentence in a paragraph, and that paragraph is a single line,
the Git diff is less readable.
With semantic linebreaks, code suggestions in GitHub Pull Requests are easier to make and use.
More information: <https://sembr.org/>.
## How to add linebreaks at the end of sentences?
1. You can start doing it manually and make it a habit.
1. You can use RStudio IDE's Visual Markdown editor with the correct wrapping option:
- Either run `aeolus::use_sentence_linebreaks()` for the current user (or `use_sentence_linebreaks("project")` for the current project);
- Or, manually in the project/global options, choose "sentence" as value for "Automatic text wrapping (line breaks)" under "R Markdown".
## How to fix a file that has no linebreaks at the end of sentences?
1. Open it with RStudio IDE's Visual Markdown editor with the correct R Markdown options (see previous section), then save.
1. Use aeolus.
## Example
This is a basic example which shows you how to solve a common problem:
```{r example}
library(aeolus)
markdown_file <- system.file("example.md", package = "aeolus")
readLines(markdown_file)
unleash(markdown_file)
readLines(markdown_file)
```
## Caveats
`aeolus::unleash()` uses the tinkr package under the hood, which means it suffers from the same limitations: for instance, files after editing only use "-", not "*", for lists.
Refer to [tinkr documentation](https://docs.ropensci.org/tinkr/#loss-of-markdown-style).
We recommend using aeolus together with version control and reviewing changes carefully before committing them.