I am writing a swirl lesson using swirlify
package functions in RStudio.
Below is how lesson.yaml
file looks like now
- Class: text
Output: Welcome to Part 1 Playing with Numbers!!!
Output for which looks like
How to insert a new line or line break after Welcome to Part 1 in lesson.yaml
file above, so that it displays the output as below when I run the demo_lesson()
command again after saving the lesson.yaml
file
| Welcome to Part 1
| Playing with Numbers!!!
Using YAML, you can use any of these equivalent approaches:
- Class: text
Output: "Welcome to Part 1\nPlaying with Numbers!!!"
- Class: text
Output: |-
Welcome to Part 1
Playing with Numbers!!!
(|
starts a literal scalar and -
tells YAML to drop the final line break.)
- Class: text
Output:
Welcome to Part 1
Playing with Numbers!!!
(since one line break gets folded into a space, you need two line breaks.)
Since I do not know whether swirlify nicely handles line breaks in the string, I guess you could also do
- Class: text
Output: Welcome to Part 1
- Class: text
Output: Playing with Numbers!!!