-
Notifications
You must be signed in to change notification settings - Fork 7
C. Editing this Wiki
Brian Clapper edited this page Oct 28, 2019
·
1 revision
When editing (or adding pages to) this wiki, please add a table of contents for each page, if the page has any headings. GitHub Wiki doesn't support doing that automatically within a page.
In the main repo, in the
top-most directory, you'll find an mdtoc.py
program. That program:
- reads a Markdown document, looking for all headings,
- ignores any header with the text "Table of Contents" (case-blind), and
- generates a new table of contents for the document.
It writes the table of contents to standard output. You can then copy that text and replace the existing table of contents in the document.
Install mdtoc.py
as follows, to make it easier:
$ cp mdtoc.py /usr/local/bin
$ chmod 755 /usr/local/bin/mdtoc.py
Obviously, you can use any directory you want, as long as it's in your path.
Note that mdtoc.py
is pretty simple-minded.
- It only handles the
# header
,## header
, etc., style of Markdown heading. (It doesn't grok underlined headings.) - It insists that the first "#" of a heading be in column 0.
One workflow, on the Mac, is:
- Delete the existing table of contents in the source document (but leaving
the
# Table of Contents
heading. - Run
mdtoc doc | pbcopy
to generate the table of contents and copy it to the Mac clipboard. - Paste into the doc.
- Check the doc into Git and push it to the repo.
(Obviously, this only works when you're editing the doc on your local machine, in a checked-out version of the wiki.)
NOTICE
- This software is copyright © 2017-2021 Databricks, Inc., and is released under the Apache License, version 2.0. See LICENSE.txt in the main repository for details.
- Databricks cannot support this software for you. We use it internally, and we have released it as open source, for use by those who are interested in building similar kinds of Databricks notebook-based curriculum. But this software does not constitute an official Databricks product, and it is subject to change without notice.