3b1b / 3Blue1Brown.com

https://www.3blue1brown.com
Other
344 stars 124 forks source link

Citations #26

Open vincerubinetti opened 3 years ago

vincerubinetti commented 3 years ago

Some method (probably another component) to put citations into lessons. Cursory thought: we have a site-wide citations.yaml in /_data that can be populated like:

- id: doi:10.10101
  title: How to add numbers
  author: Isaac Newton
  publisher: Me
  year: 2030

...

and displayed like {% include components/citation.html id="doi:10.10101" %}, and we make the citation component look how we want and have the fields we want.

This component will probably need to integrate with the "aside" component in #19 . Think holistically here.

vincerubinetti commented 3 years ago

Might want to use this: https://github.com/inukshuk/jekyll-scholar

Hopefully it has enough configurability to give us everything we need, like allowing us to list only the citations used in a particular lesson.

leios commented 3 years ago

I think the most important thing is that we are able to import a bibtex file (just a general literature.bib for everything in some directory somewhere is fine). Jekyll scholar seems to be able to do this, so I'm in favor of it!

vincerubinetti commented 3 years ago

Surprisingly, looking into React-based tools for "citations", "bibtex", "bibliography", etc, I can't find much. There are a few libraries, but they're either not maintained or no one uses them.

I actually think the simplest solution here would be to decide on a nice, consistent citation format (for example, title, authors, publisher, year), then have authors provide citations in that format to a component, or in a global /data/citations.yaml file if we think there will be overlap in the references.

I'd probably opt for something like this:

---
title: some lesson
citations:
  - isbn-1234
  - doi-1234
---

lesson content

<!-- a component built in to the lesson layout that 
reads the citations front matter, looks them up in 
citations.yaml, and lists the citations with 
autonumbering, and attached "id" attributes so you
can link to them like [some reference](#isbn-1234) -->
- id: isbn-1234
  title: Principia Mathematica
  authors: Alfred North Whitehead, Bertrand Russell 
  publisher: Puffin?
  year: 1910

If you wanted to get really fancy in the future, you could have automatic citations with Manubot. You could have a github actions workflow to that triggers on any commit, reads sources.yaml filled with a list of just identifiers like doi:10.1001/123123, runs manubot with a little python or node script, and outputs the full data (title, authors, etc) to citations.yaml, which any component could then read. I could set up something like this relatively easily; I did something like this but significantly more complex here: https://github.com/greenelab/lab-website-template/wiki/Automatic-Citations