Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
bin
data
README.md
make_notes.py

README.md

Make Notes

Use this program to generate MarkDown files from a template to be used as class notes for General Assembly WDI lessons. This program is only intended to be used by the instructional team.

Requirements

  • Python 2.7 or higher

Usage

You can also run ./make_notes.py -h to see usage as well.

usage: make_notes.py [-h] [--date DATE] [--config-path CONFIG_PATH]
                     [--notes-fields-path NOTES_FIELDS_PATH]
                     [--ignore-http-errors]
                     repo_name

Initializes a notes markdownfile based on a GitHub repo in our organization.

positional arguments:
  repo_name             the name of the repo in our organization

optional arguments:
  -h, --help            show this help message and exit
  --date DATE, -d DATE  the date string that will be added to the top of the
                        notes file of the format "<YYYY>-<MM>-<DD>". If you
                        pass the value "today", today's date will be added.
  --config-path CONFIG_PATH, -c CONFIG_PATH
                        relative path to config JSON file that sets upglobal
                        configuration for this program (see documentation for
                        config format). Default value: "./data/config.json"
  --notes-fields-path NOTES_FIELDS_PATH, -n NOTES_FIELDS_PATH
                        relative path to notes fields JSON file thatdescribes
                        the template for the Markdown notesfile created by
                        this program (see documentation for notes fields
                        format). Default value: "./data/notes_fields.json"
  --ignore-http-errors, -i
                        ignore HTTP errors when requesting informationfrom
                        remote repo README; sections in notes generated from
                        tempplate using data from remote REAMDE will be blank.

PDF Generation

Nothing is included out of the box for markdown to PDF generation, but a PDF version of notes is a nice thing to have.

You an use Typora and export as PDF.

You could npm install -g markdown-pdf and then markdown-pdf <MarkdownFile> which will put a similarly named PDF file in the dir of the markdown file.

Configuration

Out of the box, this program is configured to work with the lesson-notes repo. If you want to further configure this program for use elsewhere, there are two configuration files in data/:

  • config.json

    • the configuration keys are:
      • raw_domain: domain where the remote repos raw data lives,
      • domain: domain where the remote repos rendered data lives,
      • org_path: path to org or user where all repos live,
      • notes_rpath: relative path from this folder to the folder containing all of the notes folders,
      • objectives_pattern: string used to match "Objectives" section header,
      • next_header_pattern: string used to match all section headers
  • notes_fields.json

    • this files expects a list of objects with the following keys:
      • name: a name for the field. this is not rendered, just here for organizational purposes
      • format_str: a Python format string with named interpolation values of the format {<name of value>}.
        • valid values provided by this program are:
          • repo_name: the name of the repo passed as an argument to this program
          • date: the date argument passed to this program
          • repo_url: the url of the remote repo
          • repo_raw_url: the raw data url of the remote repo
          • readme_url: the url of the remote repo README.md
          • readme_raw_url: the raw data url of the remote repo README.md
          • readme_text: the full text of the remote repo README.md
          • objectives_md: the Objectives section text from the remote repo

Debugging

To turn on more verbose debugging with full stack trace, comment out make_notes.py:9:

sys.tracebacklimit = 0

Report issues here or contact me at arjun.ray@generalassemb.ly