@@ -24,7 +24,7 @@ options(formatR.indent = 4, width = 70)
2424knitr::opts_chunk$set(tidy = TRUE)
2525```
2626
27- # 1. Installation
27+ ## 1. Installation
2828
2929You can install ** formatR** from
3030[ CRAN] ( https://cran.r-project.org/package=formatR ) , or yihui.r-universe.dev if
@@ -49,7 +49,7 @@ library(formatR)
4949sessionInfo()
5050```
5151
52- # 2. Reformat R code
52+ ## 2. Reformat R code
5353
5454The ** formatR** package was designed to reformat R code to improve readability;
5555the main workhorse is the function ` tidy_source() ` . Features include:
@@ -109,7 +109,7 @@ Two applications of `tidy_source()`:
109109 args(glm)
110110 ```
111111
112- # 3. The Graphical User Interface
112+ ## 3. The Graphical User Interface
113113
114114If the **shiny** packages has been installed, the function `tidy_app()` can
115115launch a Shiny app to reformat R code like this (live demo at
@@ -135,7 +135,7 @@ reformatting](https://db.yihui.org/imgur/TBZm0B8.png)](https://yihui.shinyapps.i
135135if (ignore_img) cat('\n-->')
136136```
137137
138- # 4. Evaluate the code and mask output in comments
138+ ## 4. Evaluate the code and mask output in comments
139139
140140It is often a pain when trying to copy R code from other people's code which has
141141been run in R and the prompt characters (usually ` > ` ) are attached in the
@@ -161,7 +161,7 @@ tidy_eval()
161161# without specifying any arguments, it reads code from clipboard
162162```
163163
164- # 5. Showcase
164+ ## 5. Showcase
165165
166166We continue the example code in Section 2, using different arguments in
167167` tidy_source() ` such as ` arrow ` , ` blank ` , ` indent ` , ` brace.newline ` and
@@ -228,7 +228,7 @@ will be reformatted to:
228228``` {r example, eval=FALSE, tidy.opts=list(comment = FALSE, width.cutoff = 50)}
229229```
230230
231- # 6. Further notes
231+ ## 6. Further notes
232232
233233The tricks used in this packages are very dirty. There might be dangers in using
234234the functions in ** formatR** . Please read the next section carefully to know
@@ -287,7 +287,7 @@ package is unable to correctly format the code using `?` with comments, e.g.
287287In this case, it is recommended to use the function ` help() ` instead of the
288288short-hand version ` ? ` .
289289
290- # 7. How does ` tidy_source() ` actually work?
290+ ## 7. How does ` tidy_source() ` actually work?
291291
292292In a nutshell, ` tidy_source(text = code) ` is basically
293293` deparse(parse(text = code)) ` , but actually it is more complicated only because
@@ -343,7 +343,7 @@ All these special treatments to comments are due to the fact that
343343` base::parse() ` and ` base::deparse() ` can tidy the R code at the price of
344344dropping all the comments.
345345
346- # 8. Global options
346+ ## 8. Global options
347347
348348There are global options which can override some arguments in ` tidy_source() ` :
349349
0 commit comments