News for hackers. Stuff that matters.
Re:Writing a book, still the same pain 15 years later by umvi on Wednesday June 19, 2019 @11:56AM (#20224456)
It's more of a haphazard set of custom scripts I'm afraid, they are pretty messy. I really should clean them up and host on GitHub or something. But, just to get you started, here's one of my scripts (a batch script I use to generate a kindle book on Windows):

    :: Convert Markdown to DOCX format, adding a pagebreak at every \newpage
    pandoc -f markdown -t docx --filter=pandoc-docx-pagebreakpy -o build.docx ^
        foreword.md ^
        preface.md ^
        acknowledgments.md ^
        part_a.md ^
        1.md ^
        2.md ^
        3.md
    
    
    :: File needs to be opened in Word, saved, and then closed to generate physical Table of Contents :/
    @echo off
    echo Please open build.docx in Word, save, and then close.
    pause
    
    :: Set e-book metadata
    ebook-meta build.docx --authors "First M. Last" --author-sort "Last, First M." --title "Book Title" --title-sort "Book Title"
    
    :: Convert DOCX to MOBI (Kindle)
    :: --share-not-sync Makes it so cover shows up in Kindle for PC but also breaks Kindle WhisperSync. Remove if you want WhisperSync.
    :: See https://manual.calibre-ebook.com/faq.html#the-covers-for-my-mobi-files-have-stopped-showing-up-in-kindle-for-pc-kindle-for-android-ipad-etc
    :: --cover "media/cover.jpg" --share-not-sync
    ebook-convert build.docx build.mobi

There are no comments on this comment yet.