Description Usage Arguments See Also Examples
View source: R/hook_title_comment.R
Prepend title comments to each chunks. By default, title is the name of the corresponding chunk engines.
1 2 3 4 5 6 | hook_title_comment(
trigger = "title",
default = "{engine}",
args = list(),
.set = TRUE
)
|
trigger |
A name of chunk option triggers the hook. |
default |
A string or function as a default value of the |
args |
A list of arguments given to |
.set |
|
comment_title()
, comment_out()
, comment_syntax()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # Set hook which comments engine names of each chunks at the beginning.
hook_title_comment()
# Customize format
# For R chunks, let title comment be something like "chunk-label.R".
# Otherwise, fall back to the default behavior.
hook_title_comment(
default = function(options) {
if (options$engine == "R") {
return(sprintf("# %s.%s", options$label, options$engine))
}
return(comment_title(options, template = "{engine}"))
}
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.