Closed nanxstats closed 1 year ago
Hey @yihui, could you take a quick look at this PR when you get a chance? I think it improves one aspect of the text but not sure if there are other considerations when this was first written. Your feedback would be highly valuable. Thanks!
This PR proposes to use literal style multi-line string in YAML to support seamless formatting of R functions defined in the
knit
field and avoid possible confusions from indentation details.Specifically, the current code example for customizing the knit button behavior works but does not work for any non-trivial R functions containing multiple statements. For example, let's add a
print(input)
call before thermarkdown::render
call. Using the current approach:The function will be parsed as:
This does not execute:
A workaround is adding
;
after the first statement, which is non-idiomatic.Instead, if we write
This will be parsed as:
which can be correctly executed.
In reality, users can write the R function separately, copy and paste it here, and simply add two spaces before each line.