For programmers
Read programming books and documentation on your phone. Ask the AI with the code in front of you.
A PDF manual or a 600-page specification reads in one column, without zooming and with every listing intact, indentation included. The AI cites the passages it relies on, code included.
Rebasing
Note that the snapshot pointed to by the final commit you end up with, whether it's the last of the rebased commits or the final merge commit, is the same snapshot; it's only the history that is different. Rebasing replays changes from one line of work onto another in the order they were introduced, whereas merging takes the endpoints and merges them together. If you rebase commits that have already been pushed publicly, and people may have based work on those commits, then you may be in for some frustrating trouble, and the scorn of your teammates.
A PDF that finally reads well on your phone.
No zooming, no dragging from side to side, no words cut in half.
3.3. Composition19
3.4 Adding new functions
So far, we have only been using the functions that come with Python, but it is also possible to add new functions. A function definition specifies the name of a new function and the sequence of statements that run when the function is called. Here is an example:
def print_lyrics():
print("I'm a lumberjack, and I'm okay.")
print("I sleep all night and I work all day.")def is a keyword that indicates that this is a function definition. The name of the function is print_lyrics. The rules for function names are the same as for variable names: letters, numbers and under-
score are legal, but the first character can't be a number. You can't use a keyword as the name of a function, and you should avoid having a variable and a function with the same name.
19
What you see above: page 41 of the Think Python PDF (Allen Downey, CC BY-NC), as it comes out of the converter. The running header and the folio are removed, the text fits your screen and the font size you choose, and the listing stays intact: indentation, line breaks and Python colours. An EPUB with code looks the same. The text is trimmed to fit; nothing else is. The original page is still there. Switch whenever you want.
Reading programming books, documentation and papers on your phone
What changes between a 500-page book, an RFC and a two-column paper is the layout; code, index and questions work the same in all three.
A book
An O'Reilly or Manning EPUB, or a LaTeX PDF, reads without zooming, with every listing intact and coloured by its language. Every block has a copy button. Select a listing and ask what it prints or what line 4 does.
Documentation and specifications
An RFC, a reference manual or a 600-page specification opens with its index and is searchable. Ask about a specific behaviour and the answer cites the section that defines it: one tap and you are there.
A paper
A two-column arXiv paper reads in one column on your phone, with numbered equations and figures in place. Tap a figure and ask about it with the text next to it (asking about a figure needs an account).
What a PDF reader with AI does not do with code
What Marginalia does not do, and what it does not do well yet, with technical books.
It does not run the code
It shows the code and the AI explains it with the book in front of it, but nothing runs it. If you ask what it prints, the AI reasons over the listing and can be wrong: the citations in every answer take you to the listing so you can check.
Colours are a reasonable bet
If the book declares the block's language, that one is used. If not, the block itself is checked and, when that is unclear, the book's dominant language is used; when there is none, the block stays uncoloured. A snippet may come out in another language's colours. Colours can be turned off in settings.
Dense figure pages
In a two-column paper with three plots and two tables on the same page, an axis label may slip into the text. Figure pages and complex tables stay as images.
Formulas: display ones, as images
Equations on their own line, like the numbered ones in a paper, stay as images with their text for the chat. A numerical analysis or machine learning book with maths on every line is not well handled yet.
Privacy of an internal technical document
The document, never
The PDF or EPUB is stored in the browser's private storage and is not uploaded to any server. An internal specification, a company manual or a book you bought does not travel.
When you ask, the question and the passage
Your question travels with the fragments of the document needed to answer it, including the listing you point at. With an account, the document's text also passes through the server to build the search index, without being stored. With internal code, that is the line you cross: asking, or having the book indexed in your account.
With an account, your notes
Progress, highlights, notes and conversations are saved to your account so you can continue on another device. The file is not uploaded, so you open it once in each new browser.
Tested with Pro Git, an RFC and arXiv papers
The converter is tested with these freely available documents, and the reading order is compared with the published text where there is one: the Pro Git EPUB and the HTML version of the papers.
Pro Git
Chacon and Straub, 500 pages, 992 listings: reading order matches the EPUB at 99.8%.
Think Python
Downey: a LaTeX book with running headers, 244 pages and 596 listings.
Eloquent JavaScript
Haverbeke, 4th ed.: 463 pages, 651 listings.
RFC 9110 (HTTP)
All monospaced: 194 pages, 15 tables and 135 code blocks.
arXiv (CVPR and NeurIPS)
ResNet in two columns, 97.5%; Transformer with equations, 96.3%, against the ar5iv HTML version.
RISC-V unprivileged
A 670-page specification with 268 tables.
If your PDF comes from another layout and comes out wrong, tell us through “Send feedback”: the layouts that fail are the ones worth adding to the tests.
Before you open your first book.
Does it keep the code intact when turning a PDF into text?
Which languages does it colour?
Can I ask about a specific code block?
Does it work with O'Reilly and Manning EPUBs?
Can I open internal documentation from my company?
How much does it cost, and is there an API or a desktop app?
Open a book, a specification or a paper
No account and nothing to install. Pro Git is ready to try; a PDF with code converts once and stays saved in your browser. If you read often, you can install it as an app.
Free, no account. The file never leaves your browser.