On the desk

OnlineJourno.

Writing a book from your highlights

Marginalli gathers the passages you have highlighted. In a Kindle, in Apple Books, in Calibre, in Zotero, on a reMarkable.

They land in one library on your own Mac. This page is about the other half: what to do with them when you are writing something long.

The name

Marginalia are the notes people write in margins. The ending is Kannada.

-alli is the locative, the suffix that puts a thing somewhere. Mane is a house; maneyalli is in the house. So Marginalli reads as in the margin.

That is where all of this was written in the first place.

Four tools, one job each

Marginalli does not hold your bibliography and does not hold your prose. That is deliberate. Plain files pass between four programs.

Zotero holds the works — author, title, publisher, year. It is where a citation gets its facts.

Marginalli holds the passages you marked inside those works, with your own notes and tags.

Zettlr, or any editor at all, is where the chapters get written. The files are plain Markdown.

Pandoc turns the chapters into a manuscript. It turns every [@key] into a real citation, in whatever style your publisher asks for.

Only one of the four is ours. Stop using Marginalli tomorrow and the exported files are still Markdown, and still yours.

What comes out

Two buttons, for two different jobs.

Save this book as Markdown… is on a book's own screen. It writes that one book's quotes into a folder you choose. Use it to paste into a draft.

Settings → Export for writing… writes every book at once, with a citation under each quote. That is the one a manuscript is built from.

In the second, each passage arrives as a quote with its citation on the last line. Select the quote and the citation comes with it:

> The press is a business above all. [@taibbi2019hate, chap. 1]

The comment disappears when Pandoc runs. It is how a quote in chapter four can still be traced to the passage it came from.

The citation key is the join

A citation key connects a book in Marginalli to an item in Zotero. taibbi2019hate is the kind of thing Better BibTeX makes.

Use Better BibTeX and your keys already exist, pinned in each item's Extra field. For a Kindle book, something in Apple Books or a Calibre library, Zotero has no item and no key. You type one on the book's own screen.

Nothing is guessed from a title. A key that looks right and cites somebody else's book is worse than no key at all. Nothing goes wrong until the book is printed.

A missing key does not stop Pandoc. It prints a warning you may never see, carries on, and leaves (taibbi2019hate?) in your manuscript. Build with --fail-if-warnings and it stops instead.

The author, where the source names nobody

A book removed from Apple Books keeps its highlights and loses its title and its author. Every quote from it would be attributed to nobody.

So the author is a box too, beside the name on the book's own screen. What you type is used on the shelf, under each quote, and in the exported file.

The source's own answer is kept beside yours, never under it. No import overwrites what you typed.

Strays do not have to reach the manuscript

Not everything you highlighted was worth keeping. A mark made by a thumb on a train, a line selected twice, a heading caught by accident.

Hide this mark is under every passage on its book's page. It takes the mark out of that page, out of today's review, out of search and out of the export.

Nothing is deleted.

The passage keeps its notes and its tags. The book says how many it is holding back, with a link that shows them again.

A whole book goes the same way, with Hide this book. The shelf lists what you put away, with a way back beside each one.

An import cannot bring back a stray you hid.

About page numbers

Most ebooks do not have any. Apple Books and Calibre record a chapter and a position in the file. A Kindle records a location number, which is not a page and exists in no printed copy.

Only a PDF read in Zotero, or marked on a reMarkable, gives a real page number.

So the export uses what is there. A page becomes [@key, p. 45]. A chapter becomes [@key, chap. 3], which is a proper locator and what most styles ask for when citing an ebook.

Where there is neither, the citation is bare. The position sits in the comment beside it, so you can find the passage and add a page by hand. Nothing invents a number.

Every exported file counts what is still missing in its own header. One search finds every file with work left in it.

Building it

pandoc chapters/*.md --citeproc \
  --bibliography=library.bib --csl=style.csl \
  --fail-if-warnings -o book.docx

--fail-if-warnings is not optional advice. Without it a missing key becomes (key?) in the finished file and nothing stops. With it, Pandoc exits with an error, writes no file, and names the key.

Then one more check before you send anything anywhere:

grep -rn "⚠\|#verify" chapters/

That lists every quote Marginalli rebuilt rather than read, and which nobody has checked against the source. A manuscript is ready when both come back empty.

Where the quotes stay honest

Some passages this tool reconstructed rather than read — strokes on a reMarkable, say, rather than text a device recorded. Those are marked inside the quote, and the mark travels into your chapter.

Correct the passage in Marginalli and the mark goes. Edit it in the chapter and it does not, because the next export does not know you did.

That is why chapters and exports live in separate folders. Fix things where they are true, and quote from there.

Download Marginalli — free, Mac, no account. There is a fuller account of what it reads on the Marginalli page.