3

I have a question regarding generating markdown from .bib files. I've arrived at pandoc being the thing that would likely be most useful, but my attempts have failed. I tried using the following bib file (refs.bib):

@article{Author:2000aaa,
    author = "AuthorA, O. and AuthorB, T. and AuthorC, F.",
    title = "{Some title}",
    eprint = "2000.00001",
    archivePrefix = "arXiv",
    primaryClass = "hep-ph",
    doi = "10.1111/Some.DOI",
    journal = "Journal",
    volume = "1",
    number = "1",
    pages = "111111",
    year = "2000"
    month = "1"
}

you know - some generic bib file with a journal record and arxiv stuff. Now what I'd like to do is to change that to markdown, so a static website generator can make a website from it.

What I've tried are various combinations on:

pandoc --citeproc --bibliography=refs.bib --csl=chicago-annotated-bibliography.csl -o refs.md

and variations on this with whatever I found on se or te - but none of it works. I always get an empty refs.md file and I cannot figure it out.

Here are the questions:

  1. is pandoc the correct software to use, or did I go down a rabbit hole?
  2. if pandoc is the right place, how do I call it to do what I want?
  3. if pandoc is incorrect - what is the alternative.

p.s.: copy-pasting each entry by hand to refs.md obviously works, but its not very automatic :(

Willie Wong
  • 24,733
  • 8
  • 74
  • 106
liskawc
  • 43

1 Answers1

8

Two ways to do this. I've used the following .bib file:

sample.bib

@article{selkirk1974french,
    Author = {Selkirk, Elisabeth},
    Date-Added = {2018-04-24 19:07:00 +0000},
    Date-Modified = {2018-04-24 19:08:20 +0000},
    Journal = {Linguistic Inquiry},
    Pages = {573--590},
    Publisher = {JSTOR},
    Title = {French liaison and the {X$'$} notation},
    Year = {1974}}

Start with the .md file: pandoc-bib-test.md

---
bibliography: sample.bib
nocite: "@*"
---

Use the following command to convert it to an output .md file with the bibliography:

pandoc -t markdown_strict --citeproc pandoc-bib-test.md -o pandoc-bib-test-output.md --bibliography sample.bib

Output file: pandoc-bib-test-output.md

Selkirk, Elisabeth. 1974. “French Liaison and the X′ Notation.”
*Linguistic Inquiry*, 573–90.

Alternatively, create a minimal .tex document and do the conversion in the same way:

\documentclass{article}
\begin{document}
\nocite{*}
\bibliography{sample}
\end{document}

Convert using the following command:

pandoc -t markdown_strict --citeproc pandoc-bib-test.tex -o pandoc-bib-test-output.md --bibliography sample.bib

Same output file: pandoc-bib-test-output.md

Selkirk, Elisabeth. 1974. “French Liaison and the X′ Notation.”
*Linguistic Inquiry*, 573–90.
Alan Munn
  • 218,180