-
-
Save lttr/459ce1728a8b080be0132cd2ce166254 to your computer and use it in GitHub Desktop.
#!/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 ./ |
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.
I have opened the .html version in my Kobo and it works nice :)... 1 start ;)
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).
Thanks @lttr I am using the generated html version in my kobo (e-ink device)
A bit more explanation is needed:
Solved (in my case Mac os):