ReporteRs (version 0.8.2)

addMarkdown.bsdoc: Add a markdown text or file into an bsdoc object

Description

Add markdown into a bsdoc object.

Usage

# S3 method for bsdoc
addMarkdown(doc, file, text,
  text.properties = textProperties(font.size =
  getOption("ReporteRs-fontsize")),
  default.par.properties = parProperties(text.align = "justify"),
  blockquote.par.properties = parProperties(padding.top = 0, padding.bottom =
  0, shading.color = "#eeeeee"),
  code.par.properties = parProperties(shading.color = "#eeeeee"),
  hr.border = borderSolid(width = 2, color = "gray10"), ...)

Arguments

doc

Object of class bsdoc 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.

Value

an object of class bsdoc.

Details

You can configure backtick rendering (single or double backtick) with options "ReporteRs-backtick-color" and "ReporteRs-backtick-shading-color".

See Also

bsdoc, addMarkdown

Examples

Run this code
# NOT RUN {
#START_TAG_TEST
doc.filename = "addMarkdown_bsdoc/example.html"

# set default font size to 11
options( "ReporteRs-fontsize" = 11 )

doc = bsdoc( )
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) )

# Write the object
writeDoc( doc, file = doc.filename )
#STOP_TAG_TEST
# }

Run the code above in your browser using DataCamp Workspace