Object of class docx where markdown has to be added
file
markdown file. Not used if text is provided.
text
character vector. The markdown text to parse.
text.properties
default textProperties object
default.par.properties
default parProperties object
blockquote.par.properties
parProperties object used for
blockquote blocks.
code.par.properties
parProperties object used for
code blocks.
hr.border
borderProperties object used for
horizontal rules.
...
further arguments, not used.
Details
You can configure backtick rendering (single or double backtick) with
options "ReporteRs-backtick-color" and "ReporteRs-backtick-shading-color".
Value
an object of class docx.
See Also
docx, addMarkdown
Examples
doc.filename = "addMarkdown_example.docx"
options( "ReporteRs-fontsize" = 10 )
doc <- docx( )
mkd = "# This is a title 1
This is a link to the [cran] (http://cran.r-project.org/).
This paragraph demonstrates note usage[^anote]. It also show an example of
reference link like this one: [DaringFireball][1].
[^anote]: Here's a note with multiple blocks.
This paragraph is indented and belongs to the previous footnote.
This paragraph also belongs to the previous footnote.
In this way, multi-paragraph footnotes work like
multi-paragraph list items.
ls()
* This list item belongs to the previous footnote.
## This is a title 1.1
Ex turba vero imae sortis et paupertinae in tabernis aliqui pernoctant
vinariis, non nulli velariis umbraculorum theatralium latent, quae Campanam
imitatus lasciviam Catulus in aedilitate sua suspendit omnium primus
Aut pugnaciter aleis certant turpi sono fragosis naribus introrsum reducto
spiritu concrepantes; aut quod est studiorum omnium maximum ab ortu lucis
ad vesperam sole fatiscunt vel pluviis, per minutias aurigarum equorumque
praecipua vel delicta scrutantes.
Paragraphs must be separated by a blank line. Basic formatting of *italics*
and **bold** is supported. This *can be **nested** like* so. Formatting
of ``backtick`` is also
supported.
# This is a title 2
## Ordered list
1. Item 1
2. A second item
3. Number 3
## Unordered list
* An item
* Another item
* Yet another item
# Code block
x = rnorm( 1000 )
plot( density( x ) )
You can also make `inline code` to add code into other things.
# Quote
> Here is a quote. Quotes are indented
when used.
> > Subquotes are also supported.
# URLs
* A named link to [DaringFireball][1].
* Another named link to
[DaringFireball](http://daringfireball.net/projects/markdown)
* Sometimes you just want a URL like
<http://daringfireball.net/projects/markdown>.
# Miscellaneous
## Horizontal rule
A horizontal rule is a line that goes across the middle of the page.
---------
It's sometimes useful for breaking things up.
## Images
This implementation does not support images yet. Use addImage or addPlot
instead.
[1]: http://daringfireball.net/projects/markdown/
"
doc = addMarkdown( doc, text = mkd,
default.par.properties = parProperties(text.align = "justify",
padding.left = 0) )
writeDoc( doc, file = doc.filename )
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(ReporteRs)
Loading required package: ReporteRsjars
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/ReporteRs/addMarkdown.docx.Rd_%03d_medium.png", width=480, height=480)
> ### Name: addMarkdown.docx
> ### Title: Add a markdown text or file into a docx object
> ### Aliases: addMarkdown.docx
>
> ### ** Examples
>
> doc.filename = "addMarkdown_example.docx"
>
> options( "ReporteRs-fontsize" = 10 )
> doc <- docx( )
> mkd = "# This is a title 1
+
+ This is a link to the [cran] (http://cran.r-project.org/).
+
+ This paragraph demonstrates note usage[^anote]. It also show an example of
+ reference link like this one: [DaringFireball][1].
+
+ [^anote]: Here's a note with multiple blocks.
+
+ This paragraph is indented and belongs to the previous footnote.
+
+ This paragraph also belongs to the previous footnote.
+ In this way, multi-paragraph footnotes work like
+ multi-paragraph list items.
+
+ ls()
+
+ * This list item belongs to the previous footnote.
+
+ ## This is a title 1.1
+
+ Ex turba vero imae sortis et paupertinae in tabernis aliqui pernoctant
+ vinariis, non nulli velariis umbraculorum theatralium latent, quae Campanam
+ imitatus lasciviam Catulus in aedilitate sua suspendit omnium primus
+
+ Aut pugnaciter aleis certant turpi sono fragosis naribus introrsum reducto
+ spiritu concrepantes; aut quod est studiorum omnium maximum ab ortu lucis
+ ad vesperam sole fatiscunt vel pluviis, per minutias aurigarum equorumque
+ praecipua vel delicta scrutantes.
+
+ Paragraphs must be separated by a blank line. Basic formatting of *italics*
+ and **bold** is supported. This *can be **nested** like* so. Formatting
+ of ``backtick`` is also
+ supported.
+
+ # This is a title 2
+
+ ## Ordered list
+
+ 1. Item 1
+ 2. A second item
+ 3. Number 3
+
+
+ ## Unordered list
+
+ * An item
+ * Another item
+ * Yet another item
+
+ # Code block
+
+ x = rnorm( 1000 )
+ plot( density( x ) )
+
+ You can also make `inline code` to add code into other things.
+
+ # Quote
+
+ > Here is a quote. Quotes are indented
+ when used.
+ > > Subquotes are also supported.
+
+ # URLs
+
+ * A named link to [DaringFireball][1].
+ * Another named link to
+ [DaringFireball](http://daringfireball.net/projects/markdown)
+ * Sometimes you just want a URL like
+ <http://daringfireball.net/projects/markdown>.
+
+ # Miscellaneous
+
+ ## Horizontal rule
+
+ A horizontal rule is a line that goes across the middle of the page.
+
+ ---------
+
+ It's sometimes useful for breaking things up.
+
+ ## Images
+
+ This implementation does not support images yet. Use addImage or addPlot
+ instead.
+
+ [1]: http://daringfireball.net/projects/markdown/
+ "
>
> doc = addMarkdown( doc, text = mkd,
+ default.par.properties = parProperties(text.align = "justify",
+ padding.left = 0) )
>
> writeDoc( doc, file = doc.filename )
>
>
>
>
>
> dev.off()
null device
1
>