View on GitHub

scriv-git-pages

Writing in Scrivener for GitHub Pages

Setting up the project Top Splitting

ToC and Pages

It’s about time to think more seriously about breaking this little book up into pages, setting up a Table of Contents, and inter-page linking. As in all things, I’ll think about this broadly and try to go about it incrementally.

Splitting

I’ve decided to split this little book into separate HTML files, one per Section. (We’ll describe below just what a Section is, but for now, it’s basically a chapter.) Scrivener can help with this to a degree: you can get it to put a special separator line between each section. What it won’t do is close a section file and automatically open a new one.

So the plan is to write a little script, probably in Ruby, to read our one big file, and create a bunch of little files.

Titles

Right now, I’m using page titles in Scrivener, and I intend to compile them into the final documents. The alternative would be to type the title explicitly into each “chapter/page”, but I thought Scrivener can do this, why not try it.

ToC

So our Table of Contents might want to look like this:

  1. Introduction
  2. Style, Scriveners and Mine
  3. Starting the Project

Each of those lines would, of course, be a link to the page with that chapter in it. (Or, if it’s all compiled together as one big page, which I am sure I don’t like from the samples I’ve already made, they could be links to anchors.)

Scrivener isn’t much help with this. It can build a table that includes calculated page numbers, but that’s only useful in the one big file mode, so it’s not for us.

I’ve found a way to get a list of titles as plain text lines, and I’ve even mangled one of those into a list of links using Sublime and a bunch of regexes. That wasn’t fun.

Page Names

I can see two basic approaches to the page names. The top surely needs to be called index, but the others could be named like the page titles, or simply numerically. We have the titles, and they’ll be at the top of every page, so we can use them if we wish.

But is there any real advantage to me or to the reader between a file named 09.html and testing-the-compile.html? I’m not sure. Likely I’ll start with numeric ones and see what I think later.

Anchors

I happen to know that GitHub does something fancy with headings, H2 and the like. If you have a heading “### Page Names”, GitHub’s Jekyll conversion will add an HTML anchor of “page-names” to its HTML. That might come in handy, but seems more useful if we don’t make pages than if we do.

In any case, I think our next step has to be splitting the file and getting the initial split version up on GitHub. Grr. Writing is easier.

Setting up the project Top Splitting