💾 Archived View for d.moonfire.us › blog › 2018 › 08 › 25 › mfgames-writing-formats captured on 2023-11-04 at 12:25:37. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2023-04-26)
-=-=-=-=-=-=-
Not everyone in the world uses EPUB. Yes, I consider it one of the best formats for me because I can change font size or layout, there is still a big need for print books and Amazon is the source of most ebook sales (though I don't care for that either).
To handle that, MfGames Writing[1] provides a pluggable collection of different output formats. This allows you to use only the formats that you way (EPUB2, PDF, HTML) and they can be updated separately.
I appear to be writing a short series of post about the tools I use for publication and writing.
2: /blog/2018/08/13/publishing-processes/
3: /blog/2018/08/21/mfgames-writing-reasons/
4: /blog/2018/08/22/mfgames-writing-init/
5: /blog/2018/08/23/mfgames-writing-content/
6: /blog/2018/08/24/mfgames-writing-docker-and-ci/
7: /blog/2018/08/26/mfgames-writing-themes/
8: /blog/2018/08/27/mfgames-writing-releases/
Formats are consumed in the edition section of the `publication.yaml` file.
metadata: title: Test Project author: D. Moonfire language: en theme: "@mfgames-writing/clean" outputDirectory: . outputFilename: test-project-{{edition.version}}.{{edition.editionName}} editions: epub: format: "@mfgames-writing/epub2" pdf: format: "@mfgames-writing/weasyprint" isbn: 978-1-999999 html: format: "@mfgames-writing/html" images: scale: 0.25
The format is the name of the package installed with `npm install`.
The easiest format to use is EPUB2.
$ npm install @mfgames-writing/epub2 $ npm run build:html
The setup for the NPM commands can be found yesterday[9].
9: /blog/2018/08/24/mfgames-writing-docker-and-ci/
When this runs, it will generate an EPUB2 file that will be verifiable with `epubcheck`.
HTML is also pretty easy.
$ npm install @mfgames-writing/html
PDF is the complicated one and why I use a Docker image. I decided to use WeasyPrint[10] for PDF generation because it creates good-quality PDF files and works with HTML, the format themes[11] use.
11: /blog/2018/08/26/mfgames-writing-themes/
$ npm install @mfgames-writing/weasyprint
This assumes that `weasyprint` and `pdftk` are both in the PATH.
There isn't a good package for generating MOBI files directly, so the best approach to creating a Amazon MOBI file for uploading is to create a EPUB file and then use `kindlegen` to convert it.
$ npm run build:epub $ kindlegen *.epub
Like MOBI, it is hard to write a DOCX in a clean manner. To do that, we create a HTML and then convert it.
$ npm run build:html $ sed 's@@@g' < *.html \ | pandoc -f html -t docx -o test-package-0.0.0.docx
We have the extra `sed` command to remove the hypenation from `@mfgames-writing/hyphen` which makes a cleaner file.
Categories:
Tags:
Below are various useful links within this site and to related sites (not all have been converted over to Gemini).
https://d.moonfire.us/blog/2018/08/25/mfgames-writing-formats/