The function inserts or removes two hashes and a space ("## "
) at the
beginning of a line. It also works for multiple line. The function is meant
to behave similarly to the Rstudio built-in Comment / Uncomment
Selection
tool (see Details for an comprehensive description).
1 |
The function has two behaviors depending on the current selection in the document:
The current selection spans a single line. Different scenarios
The line doesn't start with "#"
(ignoring leading spaces):
the "## "
is inserted after the leading space
The line starts with "## "
(ignoring leading spaces):
the leading "## "
is removed
The line start with a regular comment "#"
(ignoring leading
spaces): the comment ("# "
or "#"
) is replaced by
"## "
. For roxygen2 comments "#'"
nothing happen.
The current selection spans multiple lines:
Any of the lines don't start with "#"
(ignoring leading
spaces): the "## "
is inserted after the smallest leading space
for all lines. For roxygen2 comment "#'"
nothing happen.
All lines start with "## "
(ignoring leading spaces):
all leading "## "
are removed.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.