# Additional Formats for MfGames Writing => .. Up a Level 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. => /tags/mfgames-writing/ 1: /tags/mfgames-writing/ # Series I appear to be writing a short series of post about the tools I use for publication and writing. * Semantic Versions and Releases[2]: Why semantic versioning helps with the writing process. => /blog/2018/08/13/publishing-processes/ 2: /blog/2018/08/13/publishing-processes/ * Evolution of MfGames Writing[3]: A brief history and reasoning behind the tools. => /blog/2018/08/21/mfgames-writing-reasons/ 3: /blog/2018/08/21/mfgames-writing-reasons/ * First Steps Using MfGames Writing[4]: Starting a new project with MfGames Writing. => /blog/2018/08/22/mfgames-writing-init/ 4: /blog/2018/08/22/mfgames-writing-init/ * Adding Content to MfGames Writing[5]: Adding front and back matter to novels. => /blog/2018/08/23/mfgames-writing-content/ 5: /blog/2018/08/23/mfgames-writing-content/ * Working with MfGames Writing, CI, and Docker[6]: Adding automatic building with commits. => /blog/2018/08/24/mfgames-writing-docker-and-ci/ 6: /blog/2018/08/24/mfgames-writing-docker-and-ci/ * Additional Formats for MfGames Writing: How to create PDF, MOBI, DOCX, and HTML versions. * Theming for MfGames Writing[7]: A light introduction on how to customize the output. => /blog/2018/08/26/mfgames-writing-themes/ 7: /blog/2018/08/26/mfgames-writing-themes/ * Integrating Semantic Versioning into MfGames Writing[8]: Tying semantic releases into the process. => /blog/2018/08/27/mfgames-writing-releases/ 8: /blog/2018/08/27/mfgames-writing-releases/ ## Using Formats Formats are consumed in the edition section of the `publication.yaml` file. ```yaml 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`. ## EPUB The easiest format to use is EPUB2. ```shell $ npm install @mfgames-writing/epub2 $ npm run build:html ``` The setup for the NPM commands can be found yesterday[9]. => /blog/2018/08/24/mfgames-writing-docker-and-ci/ 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 HTML is also pretty easy. ```shell $ npm install @mfgames-writing/html ``` ## PDF 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. => https://weasyprint.org/ 10: https://weasyprint.org/ => /blog/2018/08/26/mfgames-writing-themes/ 11: /blog/2018/08/26/mfgames-writing-themes/ ```shell $ npm install @mfgames-writing/weasyprint ``` This assumes that `weasyprint` and `pdftk` are both in the PATH. ## MOBI 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. ```shell $ npm run build:epub $ kindlegen *.epub ``` ## DOCX Like MOBI, it is hard to write a DOCX in a clean manner. To do that, we create a HTML and then convert it. ```shell $ 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. # Metadata Categories: => /categories/programming/ Programming => /categories/writing/ Writing Tags: => /tags/markdown/ Markdown => /tags/mfgames-writing/ MfGames Writing # Footer Below are various useful links within this site and to related sites (not all have been converted over to Gemini). => /now/ Now => /contact/ Contact => /bio/ Biography => /bibliography/ Bibliography => /support/ Support => /fiction/ Fiction => //fedran.com/ Fedran => https://mfgames.com/ Coding => https://moonfire.us/ The Moonfires => /categories/ Categories => /tags/ Tags => /privacy/ Privacy => /colophon/ Colophon => /license/ License => https://lists.typewriter.press/subscription?f=RDQ6f3AFHXnX2o763d5TgUmaYP7N763gR6FjZyGUUFWhyRkpgZF9I35ySICDBEdFFtgG Mailing List => https://d.moonfire.us/blog/2018/08/25/mfgames-writing-formats/