Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

markdown

Interpret cell content as markdown


Description

Cells where the markdown property is TRUE will be interpreted as markdown.

Usage

markdown(ht)
markdown(ht) <- value
set_markdown(ht, row, col, value = TRUE)
map_markdown(ht, row, col, fn)

Arguments

ht

A huxtable.

row

A row specifier. See rowspecs for details.

col

An optional column specifier.

fn

A mapping function. See mapping-functions for details.

value

A logical vector or matrix.

Set to NA to reset to the default, which is FALSE.

Details

Markdown is currently implemented for HTML, Word, Powerpoint, RTF, LaTeX and on-screen display. Word requires the ftExtra package.

Most formats use commonmark, with the "strikethrough" extension enabled.

The following features are intended to work:

  • bold and italic text

  • strikethrough (write ~~text~~ to strike through text).

  • hyperlinks

There are some quirks:

  • Paragraph-level properties (e.g. lists) won't work in Word.

  • Strikethrough will probably not work in Word.

  • To make lists work in LaTeX, set width() and ensure wrap() is TRUE.

  • Inline images in RTF work using the INCLUDEPICTURE field type.

If you try to use markdown tables within a table cell, then seek psychiatric help.

Value

markdown() returns the markdown property. set_markdown() returns the modified huxtable.

Note

Markdown content in cells is completely separate from printing the whole table as markdown using print_md(). When you set markdown to TRUE, huxtable itself interprets the cell contents as markdown, and spits out HTML, TeX or whatever.

See Also

set_markdown_contents(), a shortcut function.

Examples

jams[3, 2] <- "~2.10~ **Sale!** 1.50"
set_markdown(jams, 3, 2)

huxtable

Easily Create and Style Tables for LaTeX, HTML and Other Formats

v5.3.0
MIT + file LICENSE
Authors
David Hugh-Jones [aut, cre]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.