Skip to content

Instantly share code, notes, and snippets.

@drcjar
Last active August 15, 2016 21:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drcjar/0c2121a8bd820b8579432b0888f97a60 to your computer and use it in GitHub Desktop.
Save drcjar/0c2121a8bd820b8579432b0888f97a60 to your computer and use it in GitHub Desktop.

Title: Pandoc Pelican Practice Date: 2016-04-10 Modified: 2016-04-10 Category: Tags: meta, colophon, workflow Slug: workflow Authors: Carl Reynolds Summary: Carl's Pandoc Pelican Practice Image: https://s-media-cache-ak0.pinimg.com/736x/c4/8b/fe/c48bfed346eeb72df0d2418a809c7756.jpg

bibliography: /home/sam/Dropbox/Documents/myblog/content/computers/IPFAEA.bib csl: /home/sam/Dropbox/Documents/myblog/content/computers/the-new-england-journal-of-medicine.csl

This is written in a thingy called markdown It's good because in addition to letting you do links and being easy to read and type you can do lists and things. (it's then made into a blog by running pelican on the content and pushing it to my githubs...)

  1. Like this
  2. List of things
  3. blah blah

Or you can do points

  • point one
  • point two

And you can include pictures from the interweb

It's a dog

And stress things lots etc etc. I haven't really yet learnt all the markdown things one can do but what really makes it ace is there is then a thingy called pandoc that converts this thingy into all the other things.

Yup. And footers are a thing too1

For example if we save this as Cppp.md we can then run the command

'pandoc Cppp.md -o Cppp.doc'

to make a word doc. Just change the '.doc' for '.pdf' or '.html' etc and you can have that too. Examples attached. I think it's quite good anyway....Note that actually to get a .doc/.pdf/.html with citations the command is different (see below).

Not sold yet? It can also do smaller headings too (like this) and other things like referencing

A major feature in support for inline html and referencing using whatever you like [@Albin1999]. Here I'm using my asbestos researches bibliography file 'IPFAEA.bib' specified above in the metadata and specifying that it be formatted for the nejm.

To make a pdf the command becomes:

'pandoc Cppp.md --filter pandoc-citeproc -o Cppp.pdf'

To make a doc the command becomes:

'pandoc Cppp.md --filter pandoc-citeproc -o Cppp.docx'

And it can make tables using a variety of input formats (that you'd automagically generate using a tool) e.g grid table

+---------------+---------------+--------------------+ | Fruit | Price | Advantages | +===============+===============+====================+ | Bananas | $1.34 | - built-in wrapper | | | | - bright color | +---------------+---------------+--------------------+ | Oranges | $2.10 | - cures scurvy | | | | - tasty | +---------------+---------------+--------------------+

It's even useful for making slides. Just need to stick reveal.js folder in the same directory as the markdown then run e.g pandoc -t revealjs --self-contained -s Cppp.md -o Cppp.html

Note that a thing which isn't quite right (yet) is that the metadata needs to be structured as above for pelican but for pandoc all the things need to be enclosed between ---

References

Footnotes

  1. totally a supported thing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment