mtb: Edit Markdown

Y. Hsu

2022-10-20

library(mtb)

Background

R Markdown has been popular in many communities for presenting and sharing results. These formatting functions help to emphasis a sentence, or a paragraph. add_colored_str() adds an inline string with customized styles, including, color, background color and size. add_colored_box() adds a colored area with title to emphasis a reminder, or a warning.

How to use

This is a basic example which shows you how to format a string:

add_colored_str('Example - Warning', color=c(255,0,0), bold=TRUE, fontsize=1.5)
Example - Warning

This is an example which shows you how to add a default box:

add_colored_box(info='additional information')
  Note
additional information

This is an example which shows you how to add a reminder box:

add_colored_box(type='green-reminder', info='Here is the reminding message.', width=0.7)
  Reminder
Here is the reminding message.

This is an example which shows you how to add a warning box:

add_colored_box(type='yellow-warning', info='Here is the warning message.', width=0.9)
  Warning
Here is the warning message.

This is an example which shows you how to add a warning box with stop sign and align to the right:

add_colored_box(type='red-stop', info='Here is the warning message.', halign='r', width=0.2)
  Stop
Here is the warning message.