- Notifications
You must be signed in to change notification settings - Fork12
High Performance CommonMark and Github Markdown Rendering in R
License
r-lib/commonmark
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
High Performance CommonMark and Github Markdown Rendering in R
The CommonMark specification defines a rationalized version of markdownsyntax. This package uses the 'cmark' reference implementation for convertingmarkdown text into various formats including html, latex and groff man. Inaddition it exposes the markdown parse tree in xml format. The latest version ofthis package also adds support for Github extensions including tables, autolinksand strikethrough text.
- The
commonmarkR package - CommonMark specification for Markdown text
- Extensions for GitHub Flavored Markdown
library(commonmark)md<-"## TestAn *example* text for the `commonmark` package."# Convert to Latexcat(markdown_latex(md))
\subsection{Test}An \emph{example} text for the \texttt{commonmark} package.# Convert to HTMLcat(markdown_html(md))
<h2>Test</h2><p>An <em>example</em> text for the <code>commonmark</code> package.</p># Convert to 'groff' mancat(markdown_man(md))
.SSTest.PPAn \f[I]example\f[] text for the \f[C]commonmark\f[] package.# Convert back to (normalized) markdowncat(markdown_commonmark(md))
## TestAn *example* text for the `commonmark` package.# The markdown parse treecat(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>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:
titletextareastylexmpiframenoembednoframesscriptplaintext. - tasklist turns certain list items into checkboxes
These extensions were added by Github to supportGitHub 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>About
High Performance CommonMark and Github Markdown Rendering in R
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.