08 May, 2015

Add quotes to markdown in pandoc

The Markdown File

Add a yaml metadata section, that will point to a BibTex (.bib) file. The yaml section can be placed anywhere in the document:

---
title: "Sample Document"
output: html_document
bibliography: bogliste.bib
---

Citation in the markdown
Lorem ipsum dolor sit [@PHPWeb]

The citation points to a post in a BibLatex file in this case edited in Pybliographer:



@Book{PHPWeb,
  Author         = {Ullman, Larry},
  Title          = {P{HP} for the {W}eb},
  Publisher      = {Peachpit Press},
  year           = 2011
}


Compile html from the markdown
In order to create the file pandoc should make a standalone file (-s) and pandoc must know the name of the bibliography file (--bibliography=books.bib)

# pandoc -s --bibliography=books.bib yaml-test.markdown > yaml-test.markdown.html

Missing pandoc-citeproc
Linux Mint gave an error. Pandoc-citeproc was missing. Tried to install the package, and then the problem was solved.

#  sudo apt-get install pandoc-citeproc

Result
Lorem ipsum dolor sit (Ullman 2011)

At the end of the document the reference will appear, so you might add some markdown to state that here comes the list of sources. From the booklist the quoted (and only the quoted!) work will appear:

Ullman, Larry. 2011. PHP for the Web. Peachpit Press.

No comments: