Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

High Performance CommonMark and Github Markdown Rendering in R

License

NotificationsYou must be signed in to change notification settings

r-lib/commonmark

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

High Performance CommonMark and Github Markdown Rendering in R

CRAN_Status_BadgeCRAN RStudio mirror downloads

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.

Documentation

Basic 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>

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: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

Stars

Watchers

Forks

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp