17
Pandoc and Markdown in 5 Minutes Lightning Talk @ Open Source Open Mic Dirk Eddelbuettel 26 October 2017 OSOM Oct 2017 1/17

Pandoc and Markdown in 5 Minutes - Lightning Talk @ Open …dirk.eddelbuettel.com/papers/osom-2017-10.pdf · 2017. 10. 27. · GitHub eddelbuettel OSOMOct2017 17/17. Title: Pandoc

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Pandoc and Markdown in 5 Minutes - Lightning Talk @ Open …dirk.eddelbuettel.com/papers/osom-2017-10.pdf · 2017. 10. 27. · GitHub eddelbuettel OSOMOct2017 17/17. Title: Pandoc

Pandoc and Markdown in 5 Minutes

Lightning Talk @ Open Source Open Mic

Dirk Eddelbuettel

26 October 2017

OSOM Oct 2017 1/17

Page 2: Pandoc and Markdown in 5 Minutes - Lightning Talk @ Open …dirk.eddelbuettel.com/papers/osom-2017-10.pdf · 2017. 10. 27. · GitHub eddelbuettel OSOMOct2017 17/17. Title: Pandoc

Outline

OSOM Oct 2017 2/17

Page 3: Pandoc and Markdown in 5 Minutes - Lightning Talk @ Open …dirk.eddelbuettel.com/papers/osom-2017-10.pdf · 2017. 10. 27. · GitHub eddelbuettel OSOMOct2017 17/17. Title: Pandoc

Plan for today

• Pandoc• Markdoc• Text processing

OSOM Oct 2017 3/17

Page 4: Pandoc and Markdown in 5 Minutes - Lightning Talk @ Open …dirk.eddelbuettel.com/papers/osom-2017-10.pdf · 2017. 10. 27. · GitHub eddelbuettel OSOMOct2017 17/17. Title: Pandoc

Pandoc

OSOM Oct 2017 4/17

Page 5: Pandoc and Markdown in 5 Minutes - Lightning Talk @ Open …dirk.eddelbuettel.com/papers/osom-2017-10.pdf · 2017. 10. 27. · GitHub eddelbuettel OSOMOct2017 17/17. Title: Pandoc

Pandoc in a nutshell

• The Swiss army knife for text conversion

• From anything to anything

• Rather widely used

• Well documented, many options

• Written in Haskell (!!) by head of UCBerkeley philosophy dept (!!)

• Very scriptable in the Unix tradition;extensible via pandoc-filters

Source: Pandoc website

OSOM Oct 2017 5/17

Page 6: Pandoc and Markdown in 5 Minutes - Lightning Talk @ Open …dirk.eddelbuettel.com/papers/osom-2017-10.pdf · 2017. 10. 27. · GitHub eddelbuettel OSOMOct2017 17/17. Title: Pandoc

Markdown

OSOM Oct 2017 6/17

Page 7: Pandoc and Markdown in 5 Minutes - Lightning Talk @ Open …dirk.eddelbuettel.com/papers/osom-2017-10.pdf · 2017. 10. 27. · GitHub eddelbuettel OSOMOct2017 17/17. Title: Pandoc

Key Points

• Invented by John Gruber of Daring Fireball

• Very widely used as an easy markup language

• It is everywhere now (GitHub, StackOverflow, …)

• Might get standardised (commonmark, GitHub-flavored, …)

• Fits with Pandoc like peanut butter and jelly

OSOM Oct 2017 7/17

Page 8: Pandoc and Markdown in 5 Minutes - Lightning Talk @ Open …dirk.eddelbuettel.com/papers/osom-2017-10.pdf · 2017. 10. 27. · GitHub eddelbuettel OSOMOct2017 17/17. Title: Pandoc

Example

OSOM Oct 2017 8/17

Page 9: Pandoc and Markdown in 5 Minutes - Lightning Talk @ Open …dirk.eddelbuettel.com/papers/osom-2017-10.pdf · 2017. 10. 27. · GitHub eddelbuettel OSOMOct2017 17/17. Title: Pandoc

Integration

OSOM Oct 2017 9/17

Page 10: Pandoc and Markdown in 5 Minutes - Lightning Talk @ Open …dirk.eddelbuettel.com/papers/osom-2017-10.pdf · 2017. 10. 27. · GitHub eddelbuettel OSOMOct2017 17/17. Title: Pandoc

RMarkdown

• Integration with R via rmarkdown package• Extensive documentation by RStudio• Integration with R (and Python, SQL, …) code chunks• Dynamic and computable documents that auto-update

OSOM Oct 2017 10/17

Page 11: Pandoc and Markdown in 5 Minutes - Lightning Talk @ Open …dirk.eddelbuettel.com/papers/osom-2017-10.pdf · 2017. 10. 27. · GitHub eddelbuettel OSOMOct2017 17/17. Title: Pandoc

RMarkdown

OSOM Oct 2017 11/17

Page 12: Pandoc and Markdown in 5 Minutes - Lightning Talk @ Open …dirk.eddelbuettel.com/papers/osom-2017-10.pdf · 2017. 10. 27. · GitHub eddelbuettel OSOMOct2017 17/17. Title: Pandoc

Demo

OSOM Oct 2017 12/17

Page 13: Pandoc and Markdown in 5 Minutes - Lightning Talk @ Open …dirk.eddelbuettel.com/papers/osom-2017-10.pdf · 2017. 10. 27. · GitHub eddelbuettel OSOMOct2017 17/17. Title: Pandoc

Our ‘Template’

OSOM Oct 2017 13/17

Page 14: Pandoc and Markdown in 5 Minutes - Lightning Talk @ Open …dirk.eddelbuettel.com/papers/osom-2017-10.pdf · 2017. 10. 27. · GitHub eddelbuettel OSOMOct2017 17/17. Title: Pandoc

Our ‘Deployment’

#!/bin/sh

for i in 1 2 3; dormdfile=”demo${i}.Rmd”pdffile=”demo${i}.pdf”echo ${rmdfile}cp -vax demo.Rmd ${rmdfile}Rscript -e 'rmarkdown::render(”'${rmdfile}'”)'test -f ${pdffile} && xdg-open ${pdffile}

done

OSOM Oct 2017 14/17

Page 15: Pandoc and Markdown in 5 Minutes - Lightning Talk @ Open …dirk.eddelbuettel.com/papers/osom-2017-10.pdf · 2017. 10. 27. · GitHub eddelbuettel OSOMOct2017 17/17. Title: Pandoc

Result

OSOM Oct 2017 15/17

Page 16: Pandoc and Markdown in 5 Minutes - Lightning Talk @ Open …dirk.eddelbuettel.com/papers/osom-2017-10.pdf · 2017. 10. 27. · GitHub eddelbuettel OSOMOct2017 17/17. Title: Pandoc

Summary

Pandoc

• rocks as very versatile to/from anything converter• highly scriptable, widely available

Markdown

• has won the markup languages fight• is literally everywhere, dialects exists though

RMarkdown

• highly customizable• highly expressive

OSOM Oct 2017 16/17

Page 17: Pandoc and Markdown in 5 Minutes - Lightning Talk @ Open …dirk.eddelbuettel.com/papers/osom-2017-10.pdf · 2017. 10. 27. · GitHub eddelbuettel OSOMOct2017 17/17. Title: Pandoc

Contact

[email protected]

Websitehttp://dirk.eddelbuettel.com

Twitter@eddelbuettel

GitHubeddelbuettel

OSOM Oct 2017 17/17