File: commonmark.Rd

package info (click to toggle)
r-cran-commonmark 1.9.5-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 1,192 kB
  • sloc: ansic: 10,131; sh: 14; makefile: 6
file content (115 lines) | stat: -rw-r--r-- 2,973 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/markdown.R
\name{commonmark}
\alias{commonmark}
\alias{markdown_html}
\alias{markdown}
\alias{markdown_xml}
\alias{markdown_man}
\alias{markdown_commonmark}
\alias{markdown_text}
\alias{markdown_latex}
\title{Parse and render markdown text}
\usage{
markdown_html(
  text,
  hardbreaks = FALSE,
  smart = FALSE,
  normalize = FALSE,
  sourcepos = FALSE,
  footnotes = FALSE,
  extensions = FALSE
)

markdown_xml(
  text,
  hardbreaks = FALSE,
  smart = FALSE,
  normalize = FALSE,
  sourcepos = FALSE,
  footnotes = FALSE,
  extensions = FALSE
)

markdown_man(
  text,
  hardbreaks = FALSE,
  smart = FALSE,
  normalize = FALSE,
  footnotes = FALSE,
  width = 0,
  extensions = FALSE
)

markdown_commonmark(
  text,
  hardbreaks = FALSE,
  smart = FALSE,
  normalize = FALSE,
  footnotes = FALSE,
  width = 0,
  extensions = FALSE
)

markdown_text(
  text,
  hardbreaks = FALSE,
  smart = FALSE,
  normalize = FALSE,
  footnotes = FALSE,
  width = 0,
  extensions = FALSE
)

markdown_latex(
  text,
  hardbreaks = FALSE,
  smart = FALSE,
  normalize = FALSE,
  footnotes = FALSE,
  width = 0,
  extensions = FALSE
)
}
\arguments{
\item{text}{Markdown text}

\item{hardbreaks}{Treat newlines as hard line breaks. If this option is specified, hard wrapping is disabled
regardless of the value given with \code{width}.}

\item{smart}{Use smart punctuation. See details.}

\item{normalize}{Consolidate adjacent text nodes.}

\item{sourcepos}{Include source position attribute in output.}

\item{footnotes}{parse footnotes}

\item{extensions}{Enables Github extensions. Can be \code{TRUE} (all) \code{FALSE} (none) or a character
vector with a subset of available \link{extensions}.}

\item{width}{Specify wrap width (default 0 = nowrap).}
}
\description{
Converts markdown text to several formats using John MacFarlane's \href{https://github.com/commonmark/cmark}{cmark}
reference implementation. Supported output formats include \code{html}, \code{latex}, groff \code{man}, and normalized
"commonmark" markdown. In addition the markdown parse tree can be returned in xml format.
}
\details{
Support for extensions (including tables and autolink) is provided via the Github
\href{https://github.com/github/cmark-gfm}{fork} of cmark. For now these are opt-in and have to be
enabled with the \code{extensions} parameter. See also the manual page on \link{extensions}.

When smart punctuation is enabled, straight double and single quotes will be rendered as curly quotes,
depending on their position. Moreover \verb{--} will be rendered as -- (en-dash), \verb{---} will be
rendered as --- (em-dash), and \code{...} will be rendered as ... (ellipses).
}
\examples{
md <- readLines("https://raw.githubusercontent.com/yihui/knitr/master/NEWS.md")
html <- markdown_html(md)
xml <- markdown_xml(md)
man <- markdown_man(md)
tex <- markdown_latex(md)
cm <- markdown_commonmark(md)
text <- markdown_text(md)
}