Skip to content

Instantly share code, notes, and snippets.

@lttr
Created January 18, 2024 13:18
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lttr/459ce1728a8b080be0132cd2ce166254 to your computer and use it in GitHub Desktop.
Save lttr/459ce1728a8b080be0132cd2ce166254 to your computer and use it in GitHub Desktop.
I wanted to read the VueJS docs on my eink tablet. HTML seems to work even better then EPUB in Boox NeoReader app.
#!/usr/bin/env bash
set -e
TEMPORARY="vue-docs.md"
GUIDE_PATH="./src/guide/"
OUTPUT_EPUB="vue-docs.epub"
OUTPUT_HTML="vue-docs.html"
git clone --depth=1 https://github.com/vuejs/docs
cd docs
touch ${GUIDE_PATH}${TEMPORARY}
cat .vitepress/config.ts | rg -v 'html|//' | rg "/guide/[^']+" --only-matching | while read -r guide_path; do
CURRENT_GUIDE=`echo $guide_path | xargs dirname | xargs basename`
cat "src${guide_path}.md" | sed "s#images/#${CURRENT_GUIDE}/images/#" >> ${GUIDE_PATH}${TEMPORARY}
done
cd $GUIDE_PATH
pandoc $TEMPORARY -o $OUTPUT_EPUB
pandoc $TEMPORARY -o $OUTPUT_HTML
cd ../..
mv ${GUIDE_PATH}$OUTPUT_EPUB ./
mv ${GUIDE_PATH}$OUTPUT_HTML ./
@fguillen
Copy link

fguillen commented Jan 26, 2024

A bit more explanation is needed:

script.sh: line 14: rg: command not found

Solved (in my case Mac os):

brew install ripgrep

script.sh: line 20: pandoc: command not found

brew install pandoc

@fguillen
Copy link

fguillen commented Jan 26, 2024

It works... I would say: 70%

Opening the .epub with the Books app in my mac I see several errors with this message:

This page contains the following errors:error on line 342 at column 14: Specification mandates value for attribute setup
Below is a rendering of the page up to the first error.

@fguillen
Copy link

I have opened the .html version in my Kobo and it works nice :)... 1 start ;)

@lttr
Copy link
Author

lttr commented Jan 26, 2024

Thank you for the comments. The use case is to be able to read the docs sort of comfortably with minimal effort. The input format and the build would have to be more sofisticated for e-book like level, this script was an attempt to have good enough experiance (reading inside browser was slighly below this on my e-ink device).

@fguillen
Copy link

fguillen commented Jan 27, 2024

Thanks @lttr I am using the generated html version in my kobo (e-ink device)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment