---
title: "format_test_1"
author: "Nuo Wen Lei"
date: "7/27/2021"
output: html_document
---

This is test 1 for the addin that formats code chunk labels. 

## Section 1
###

### Exercise 1


Purpose of this initial code chunk is to ensure format_tutorial() does not act on it. A code chunk without either "exercise," "eval," or "include" should not be changed.

```{r}

```



```{r section-1-1, exercise = TRUE}

```

<button onclick = "transfer_code(this)">Copy previous code</button>

```{r section-1-1-hint-1, eval = FALSE}

```

```{r section-1-1-test, include=FALSE}

```


###

### Exercise 2


```{r section-1-2, exercise = TRUE}

```

<button onclick = "transfer_code(this)">Copy previous code</button>

```{r section-1-2-hint-1, eval = FALSE}

```

Testing to see if an unlabeled code chunk at the end also is unchanged, as it should be.

```{r}

```


###

### Exercise 3


```{r section-1-3}
question_text(NULL,
	message = "answer here",
	answer(NULL,
	correct = TRUE),
	allow_retry = FALSE,
	incorrect = NULL,
	rows = 6)
```

###


### Exercise 4


```{r section-1-4, exercise = TRUE}

```

<button onclick = "transfer_code(this)">Copy previous code</button>

```{r section-1-4-hint-1, eval = FALSE}

```

###

A code chunk with the label setup should not be changed:

```{r setup, include = FALSE}
library(learnr)
``

None of the default tutorial helpers should be changed:

```{r copy-code-chunk, child = system.file("child_documents/copy_button.Rmd", package = "tutorial.helpers")}
```

```{r info-section, child = system.file("child_documents/info_section.Rmd", package = "tutorial.helpers")}
```

```{r download-answers, child = system.file("child_documents/download_answers.Rmd", package = "tutorial.helpers")}

## Section 2
###

### Exercise 1


```{r section-2-1, exercise = TRUE}

```

<button onclick = "transfer_code(this)">Copy previous code</button>

```{r section-2-1-hint-1, eval = FALSE}

```

###

### Exercise 2


```{r section-2-2}
question_text(
	"prompt here",
	answer(NULL, correct = TRUE),
	allow_retry = TRUE,
	try_again_button = "Text for button",
	incorrect = NULL)
```

###

### Exercise 3

Ignore anything within a four backtick environment, including headers and code chunks.

````
### Exercise 6

```{r exercises-1, exercise = TRUE}

```
````

Also ignore data printouts:

````
> head(diamonds)
# A tibble: 6 × 10
  carat cut       color clarity depth table price     x     y     z
  <dbl> <ord>     <ord> <ord>   <dbl> <dbl> <int> <dbl> <dbl> <dbl>
1  0.23 Ideal     E     SI2      61.5    55   326  3.95  3.98  2.43
2  0.21 Premium   E     SI1      59.8    61   326  3.89  3.84  2.31
3  0.23 Good      E     VS1      56.9    65   327  4.05  4.07  2.31
4  0.29 Premium   I     VS2      62.4    58   334  4.2   4.23  2.63
5  0.31 Good      J     SI2      63.3    58   335  4.34  4.35  2.75
6  0.24 Very Good J     VVS2     62.8    57   336  3.94  3.96  2.48
>
````



```{r section-2-3, exercise = TRUE}

```

<button onclick = "transfer_code(this)">Copy previous code</button>

```{r section-2-3-hint-1, eval = FALSE}

```

###

### Exercise 4

Don't change a chunk with the "file" option.

```{r file = "images/chunk-example.txt", echo = TRUE, eval = FALSE}
```

Should work even if there are no labels, even if the comma is not included. The option tells us what kind of chunk it is, and therefor, how to label it.

```{r section-2-4, , exercise = TRUE}

```

<button onclick = "transfer_code(this)">Copy previous code</button>

```{r section-2-4-test, include = FALSE}

```

```{r section-2-4-hint-1, eval = FALSE}

```

###

## Exercises 
### 

Weird case which used to produce exercises--1 instead of exercise-1.

### Exercise 1

```{r exercises-1, exercise = TRUE}

```

## Hask marks 
### 

An example to conform that hashmarks within four backtick environments do not mess up the reformatting. This test confirms that the exercise section number and the code chunk label get changed.

````
penguins

# A tibble: 344 × 8
   species island    bill_length_mm bill_depth_mm flipper_length_mm body_mass_g
   <fct>   <fct>              <dbl>         <dbl>             <int>       <int>
 1 Adelie  Torgersen           39.1          18.7               181        3750
 2 Adelie  Torgersen           39.5          17.4               186        3800
 3 Adelie  Torgersen           40.3          18                 195        3250
 4 Adelie  Torgersen           NA            NA                  NA          NA
 5 Adelie  Torgersen           36.7          19.3               193        3450
 6 Adelie  Torgersen           39.3          20.6               190        3650
 7 Adelie  Torgersen           38.9          17.8               181        3625
 8 Adelie  Torgersen           39.2          19.6               195        4675
 9 Adelie  Torgersen           34.1          18.1               193        3475
10 Adelie  Torgersen           42            20.2               190        4250
# ℹ 334 more rows
# ℹ 2 more variables: sex <fct>, year <int>
````

### Exercise 4

```{r zz, exercise = TRUE}

```

## Four ticks problem
### 

### Exercise 2

Test to make sure that this four backtick environment does not cause trouble. Not sure what made this trouble in previous versions!

````

````  

```{r zz, exercise = TRUE}

```

## GitHub Pages Output Problem
### 

Problem is that the Terminal output from GitHub Pages publishing command causes problems.

````
dkane@macbook project-1 % quarto publish gh-pages quarto-1.qmd
? Publish site to https://davidkane9.github.io/project-1/ using gh-pages? (Y/n) › Yes
````

The first time you publish, Quarto will confirm the location, which is just the standard GitHub Pages address, using your user name and the repo name.

````
Saved working directory and index state WIP on main: 71e6d06 initial version
Switched to a new branch 'gh-pages'
[gh-pages (root-commit) b8263f3] Initializing gh-pages branch
remote: 
remote: Create a pull request for 'gh-pages' on GitHub by visiting:        
remote:      https://github.com/davidkane9/project-1/pull/new/gh-pages        
remote: 
To https://github.com/davidkane9/project-1.git
 * [new branch]      HEAD -> gh-pages
 ````

 Quarto interacts with your GitHub repo directly, creating a new branch, `gh-pages`, which will be used to construct the website. 

````
[✓] Deploying gh-pages branch to website (this may take a few minutes)
[✓] Published to https://davidkane9.github.io/project-1/

dkane@macbook project-1 % 
```` 


### Exercise 2

 

```{r zz, exercise = TRUE}

```

## Space   Test Case 1
###

This test ensures that (mistaken) extra spaces in a section name are replaced by a single dash in code chunk names rather than multiple dashes.

### Exercise 2

```{r zz, exercise = TRUE}

```

### Exercise 4

Had some problems with the new version of "no-answer" type questions. In particular, format_tutorial() had trouble with the test code chunk, perhaps because of the combination of -test in the code chunk name and `echo = TRUE`. The current problem is that the code chunk name in the test code block is not updated by check_format_tutorial().

```{r space---test-case-1-5}
question_text(NULL,
	answer(NULL, correct = TRUE),
	allow_retry = TRUE,
	try_again_button = "Edit Answer",
	incorrect = NULL,
	rows = 5)
```

###

```{r space---test-case-1-5-test, echo = TRUE}

```

###

