View source: R/move_asterisks.R
move_asterisks | R Documentation |
move_asterisks
finds all locations of an asterisk plus a
space or a space plus an asterisk and swaps the positions of the spaces and
the asterisks. It also makes sure that your string doesn't end in two
asterisks by removing the terminal asterisk.
How to use this: Say you've got a string that is a figure caption
with two italicized references included inside the string. If you try to
put the whole caption in italics in a .Rmd file with *`r
MyCaption`*
, the italics will be messed up and you will likely have an
extra asterisk at the end of the final output in the knitted document. This
fixes that.
move_asterisks(string, num_asterisks_to_match = NA)
string |
a string of text, e.g., a figure or table caption for use in an Rmarkdown document that will be italicized |
num_asterisks_to_match |
number of asterisks to match and move. If left as NA, this will move sets of 3, 2, and then 1 asterisks. If set to 3, 2, or 1, though, it will only look for that number to match and move. |
a string
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.