Skip to content

evanlh/code2pdf

Repository files navigation

What is this?

One day I woke up & thought “Wouldn’t it be nice to be able to study a codebase like a book? Just curl up with a repo & study away, no distractions or notifications?”

This is an attempt to answer that question. The answer is it’s not very nice, codebases are just too big, it’s like reading a non-linear War & Peace without the aid of hypertext navigation.

But you’re welcome to try for yourself, it was still a fun experiment.

Installation

npm i

Usage

To print usage info

$ npm run code2pdf

Which will echo…

Usage: index [options]

Options:
  -t, --theme <cssfile>        Specify theme css
  -d, --directory <directory>  One or more directories to traverse
  -o, --output <outputfile>    Path to write PDF file to
  -p, --pagesize <pagesize>    A3|A4|A5|A6
  -h, --help                   output usage information

To pass arguments in, use `npm run`’s facility:

$ npm run code2pdf -- -d /path/to/my/code -o /path/to/output.pdf

Bugs & Issues

  • You have to be very explicit about what the directory you want crawled (usually `src`) because detection of what is vs is not source code is currently very poor.
  • There is currently no way of specifying globs of files to include/exclude
  • I need to upgrade the version of highlight.js

About

Beautiful Print-ready Code

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published