Skip to contents

Draws a line of markdown, such as a plot title, with LaTeX math between $...$. **bold**, *italic*, `code` and ~~strike~~ work, and so does some inline HTML. For headings, lists, tables and other blocks, use markdown_box_grob().

Usage

markdown_grob(md, style = NULL, ...)

grid.markdown(md, ...)

Arguments

md

Markdown, as a character string.

style

A markdown_style(), CSS text, or a path to a .css file. NULL (default) uses latex_options("markdown_style"), if set. Only properties marked inline in md_style() apply.

...

Passed to latex_grob(), such as x, y, hjust, vjust, rot, max_width and gp.

Value

A grob, as from latex_grob(). grid.markdown() draws it and returns it invisibly.

Details

These HTML tags are supported:

tageffect
<b>, <strong>bold
<i>, <em>, <cite>, <dfn>, <var>, <address>italic
<code>, <kbd>, <samp>, <tt>monospace
<u>, <ins>underline
<s>, <del>, <strike>strikethrough
<sub>, <sup>sub / superscript
<mark>yellow highlight
<small>, <big>smaller / larger
<q>quotation marks
<br>line break
<span style="...">see below

A style attribute can set color, text-decoration (underline, line-through), font-size (such as 12pt, 1.2em or smaller) and font-family; other properties are ignored. Colours are R colour names, CSS names, #rgb, #rrggbb or rgb(). font-family takes serif, sans-serif, monospace, an installed font, or a font named with load_font().

Tags nest and can hold markdown and math. Other tags are dropped and their text kept. Links keep their text only. Images must be local PNG, JPEG or SVG files. The characters U+E000 to U+E002 are removed from the input.

Examples

# \donttest{
  grid::grid.newpage()
  grid.markdown(r"(The **fitted** slope is $\beta_1$, *p* < 0.001)")

# }