This repository holds a Jekyll-based version of the Data 8 textbook.
All textbook content is primarily stored in Jupyter notebooks in the notebooks/
folder.
This can be converted to Jekyll-ready markdown and served on github pages. Here
are steps to get started:
Install the proper dependencies. You can do this by installing the
Anaconda environment specified in environment.yml
:
conda env create -f environment.yml
Once this is finished, activate the environment
conda activate textbook
Ensure that a SUMMARY.md
file exists in the root of the repository. This contains
a markdown list of bullet points and links. Each item corresponds to a chapter in the
textbook, and is used to build the table of contents in the sidebar.
If you do not have a SUMMARY.md
file made for this textbook, you may create one
by hand, or generate one from the folders/files in notebooks/
by running the following
script:
python scripts/generate_summary_from_folders.py
Build the textbook with the following command:
python scripts/generate_textbook.py
This will:
nbconvert
to turn the .ipynb
files into markdown{{ site.baseurl }}
base for JekyllYou can the push the changes to GitHub, which will automatically build a Jekyll site with your newly-created Markdown files.
To preview your built site using Jekyll on your computer, take the following steps:
Ensure that Jekyll and Ruby are installed. See the Jekyll docs for information on this. As well as the GitHub gh-pages documentation for more information on how Jekyll and GitHub interact.
Ensure that your notebooks have been converted to markdown:
python scripts/generate_textbook.py
Run the Jekyll site preview command:
bundle exec jekyll serve
This should open up a port on your computer with a live version of the textbook.
notebooks/
contains all course content in Jupyter notebook form
data/
contains the CSV data files used in the course textbook
images/
contains images referenced in the course
SUMMARY.md
contains a markdown list of chapters / paths to your textbook files. For
example, here is a sample from the Data 8 textbook:
* [1. Data Science](notebooks/01/what-is-data-science.md)
* [1.1 Introduction](notebooks/01/1/intro.md)
* [1.1.1 Computational Tools](notebooks/01/1/1/computational-tools.md)
* [1.2 Why Data Science?](notebooks/01/2/why-data-science.md)
* [2. Causality and Experiments](notebooks/02/causality-and-experiments.md)
* [2.1 John Snow and the Broad Street Pump](notebooks/02/1/observation-and-visualization-john-snow-and-the-broad-street-pump.md)
* [2.2 Snow’s “Grand Experiment”](notebooks/02/2/snow-s-grand-experiment.md)
images/textbook
contains images generated during the notebook conversion_textbook/
contain notebooks converted to markdown_site/
contains the HTML for the built site. It is created by Jekyll, and should only exist if you build the site locally_config.yml
contains all site configuration._data/navigation.yml
contains site navigation as well as auto-generated sidebar yamlscripts/
contains scripts to generate the textbook from the Jupyter notebooksassets/css
contains CSS for the textbook and websiteenvironment.yml
contains the environment needed to build the textbook