Skip to content

gongzhang/you-dont-know-js-epub

Repository files navigation

you-dont-know-js-epub

"You Don't Know JS Yet" (1st/2nd editions) ePub generator.

Generate the ePub

Run with Docker:

# force update to the latest image
docker pull gongzhang/ydkjs-epub

# generate epub into output folder
docker run --rm -it -v $PWD/output:/root/output gongzhang/ydkjs-epub

Then the generated epub files are in output folder:

Note that the first two books (Get Started and Scope & Closures) are from the latest 2nd edition, and the rest are from the 1st edition.

Customization

First, recursively clone this repo to your machine:

git clone --recursive [email protected]:gongzhang/you-dont-know-js-epub.git

Then you can:

  • Modify epub.css to customize the style.
  • Read gen.sh to understand how the generator works.
  • Fetch the latest book content using git submodule command under 1st-edition and 2nd-edition directory.

Finally, rebuild the Docker image and generate your own version epubs:

docker build -t ydkjs-epub .
docker run --rm -it -v $PWD/output:/root/output ydkjs-epub

additional Note (to get latest content)

# initial your git submodule in your local repo
git submodule init

# Change to the submodule directory
# replace 'submodule_dir' with '1st-edition' & '2nd-edition' respectively
cd submodule_dir

# Checkout desired branch
# replace 'master' with updated branch respectively
# At 2020/07/05, it is '1st-ed' and '2nd-ed' respectively

git checkout master

# Update
git pull

# Get back to your project root
cd ..

Known Issues & TODOs

  • Support syntax highlighing (The latest pandoc does support syntax highlight, but the genrated ePub cannot be correctly rendered by iBooks app.)