Package: commonmark 1.9.5

Jeroen Ooms

commonmark: High Performance CommonMark and Github Markdown Rendering in R

The CommonMark specification <https://github.github.com/gfm/> defines a rationalized version of markdown syntax. This package uses the 'cmark' reference implementation for converting markdown text into various formats including html, latex and groff man. In addition it exposes the markdown parse tree in xml format. Also includes opt-in support for GFM extensions including tables, autolinks, and strikethrough text.

Authors:Jeroen Ooms [aut, cre], John MacFarlane [cph]

commonmark_1.9.5.tar.gz
commonmark_1.9.5.zip(r-4.5)commonmark_1.9.5.zip(r-4.4)commonmark_1.9.5.zip(r-4.3)
commonmark_1.9.5.tgz(r-4.5-x86_64)commonmark_1.9.5.tgz(r-4.5-arm64)commonmark_1.9.5.tgz(r-4.4-x86_64)commonmark_1.9.5.tgz(r-4.4-arm64)commonmark_1.9.5.tgz(r-4.3-x86_64)commonmark_1.9.5.tgz(r-4.3-arm64)
commonmark_1.9.5.tar.gz(r-4.5-noble)commonmark_1.9.5.tar.gz(r-4.4-noble)
commonmark_1.9.5.tgz(r-4.4-emscripten)commonmark_1.9.5.tgz(r-4.3-emscripten)
commonmark.pdf |commonmark.html
commonmark/json (API)
NEWS

# Install 'commonmark' in R:
install.packages('commonmark', repos = c('https://ropensci.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/r-lib/commonmark/issues

Pkgdown site:https://docs.ropensci.org

On CRAN:commonmark-1.9.5(2025-03-17)

Conda:

cmarkcmark-gfmgfmmarkdown

13.69 score 93 stars 2.2k packages 90 scripts 635k downloads 7 exports 0 dependencies

Last updated 12 hours agofrom:6fafdd621a (on main). Checks:12 OK. Indexed: yes.

TargetResultLatest binary
Doc / VignettesOKMar 22 2025
R-4.5-win-x86_64OKMar 22 2025
R-4.5-mac-x86_64OKMar 22 2025
R-4.5-mac-aarch64OKMar 22 2025
R-4.5-linux-x86_64OKMar 22 2025
R-4.4-win-x86_64OKMar 22 2025
R-4.4-mac-x86_64OKMar 22 2025
R-4.4-mac-aarch64OKMar 22 2025
R-4.4-linux-x86_64OKMar 22 2025
R-4.3-win-x86_64OKMar 22 2025
R-4.3-mac-x86_64OKMar 22 2025
R-4.3-mac-aarch64OKMar 22 2025

Exports:list_extensionsmarkdown_commonmarkmarkdown_htmlmarkdown_latexmarkdown_manmarkdown_textmarkdown_xml

Dependencies:

Citation

To cite package ‘commonmark’ in publications use:

Ooms J (2025). commonmark: High Performance CommonMark and Github Markdown Rendering in R. R package version 1.9.5, https://github.com/r-lib/commonmark.

Corresponding BibTeX entry:

  @Manual{,
    title = {commonmark: High Performance CommonMark and Github
      Markdown Rendering in R},
    author = {Jeroen Ooms},
    year = {2025},
    note = {R package version 1.9.5},
    url = {https://github.com/r-lib/commonmark},
  }

Readme and manuals

commonmark

High Performance CommonMark and Github Markdown Rendering in R

CRAN_Status_Badge CRAN RStudio mirror downloads

The CommonMark specification defines a rationalized version of markdown syntax. This package uses the 'cmark' reference implementation for converting markdown text into various formats including html, latex and groff man. In addition it exposes the markdown parse tree in xml format. The latest version of this package also adds support for Github extensions including tables, autolinks and strikethrough text.

Documentation

Basic Markdown

library(commonmark)
md <- "## Test
An *example* text for the `commonmark` package."

# Convert to Latex
cat(markdown_latex(md))
\subsection{Test}

An \emph{example} text for the \texttt{commonmark} package.
# Convert to HTML
cat(markdown_html(md))
<h2>Test</h2>
<p>An <em>example</em> text for the <code>commonmark</code> package.</p>
# Convert to 'groff' man 
cat(markdown_man(md))
.SS
Test
.PP
An \f[I]example\f[] text for the \f[C]commonmark\f[] package.
# Convert back to (normalized) markdown
cat(markdown_commonmark(md))
## Test

An *example* text for the `commonmark` package.
# The markdown parse tree
cat(markdown_xml(md))
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE document SYSTEM "CommonMark.dtd">
<document xmlns="http://commonmark.org/xml/1.0">
  <heading level="2">
    <text>Test</text>
  </heading>
  <paragraph>
    <text>An </text>
    <emph>
      <text>example</text>
    </emph>
    <text> text for the </text>
    <code>commonmark</code>
    <text> package.</text>
  </paragraph>
</document>

Github Extensions

Commonmark includes several 'extensions' to enable features which are not (yet) part of the official specification. The current version of the commonmark R package offers 4 such extensions:

  • table support rendering of tables
  • strikethough via ~sometext~ syntax
  • autolink automatically turn URLs into hyperlinks
  • tagfilter blacklist html tags: title textarea style xmp iframe noembed noframes script plaintext.
  • tasklist turns certain list items into checkboxes

These extensions were added by Github to support GitHub Flavored Markdown.

table <- '
aaa | bbb | ccc | ddd | eee
:-- | --- | :-: | --- | --:
fff | ggg | hhh | iii | jjj'

cat(markdown_latex(table, extensions = TRUE))
\begin{table}
\begin{tabular}{llclr}
aaa & bbb & ccc & ddd & eee \\
fff & ggg & hhh & iii & jjj \\
\end{tabular}
\end{table}
cat(markdown_html(table, extensions = TRUE))
<table>
<thead>
<tr>
<th align="left">aaa</th>
<th>bbb</th>
<th align="center">ccc</th>
<th>ddd</th>
<th align="right">eee</th>
</tr>
</thead>
<tbody>
<tr>
<td align="left">fff</td>
<td>ggg</td>
<td align="center">hhh</td>
<td>iii</td>
<td align="right">jjj</td>
</tr></tbody></table>

Help Manual

Help pageTopics
Parse and render markdown textcommonmark markdown markdown_commonmark markdown_html markdown_latex markdown_man markdown_text markdown_xml
Github CommonMark Extensionsextensions list_extensions