Pandoc, Markdown and eBook-production

Why don’t you save the long pandoc command lines as a bash script?

In this project I write in Markdown most of the time. I may need the same text in many formats:

  • .docx for the boss
  • .pdf for nice presentations
  • .tex for serious work
  • .epub for ebooks
  • .mobi for Kindle

I have chosen to write most of my texts in Markdown. Pandoc can transform Markdown to all the formats above. Except perhaps .mobi. Here you need Amazon’s kindlegen.

In order to create an Ebook and a Kindle version, you need to:

pandoc myText.md -o myText.epub
kindlegen myText.epub

Kindlegen will create a file with the .mobi extension: myFile.mobi. That’s it. Your book is ready for Kindle.

Here’s a list of pages, that I tend to use over and over again:

Let’s try a conversion from Markdown to an eBook. The –ebook-cover will ad a frontpage. So you’ll have an eBook with a nice cover. The –toc means Table of Content.

pandoc -s --epub-cover-image=owl.jpg --toc meta.txt markdown.md -o x.epub

As you progress the pandoc commandline tends to become very long indeed. I save such lines i as a bash script. Here’s a sample:

#!/bin/bash
# Create the eBook and a Kindle version of the same
pandoc -S --epub-cover-image=owl.jpg --toc -o yourBook.epub meta.txt markdown.md
kindlegen yourBook.epub

Save the file as myFile.sh. Then run this command: chmod a+x myFile.sh. Now you can run the entire command like this:

./myFile.sh

in a terminal. As soon as your pandoc command works you can save it for future use. You could even save the script in

/usr/local/bin/

Then you can use your script as a Linux command.

I’m sure that you can do something similar in Windows or OSX. In the heyday of MS DOS I might have saved the pandoc command in a .bat file. But in the end I prefer a Linux solution.

By thine own ingenium create your solution …

 

Better PDF support

In this blogpost by Mike Schroder you can see, that WordPress will have better PDF support from WP 4.7.

Mike Schroder: better PDF support from WP 4.7
Mike Schroder: better PDF support from WP 4.7 (image from Mike Schroder’s blog post).

However, the PDF support needs several dependencies:

Core support is provided through WP_Image_Editor_Imagick and requires Imagick, ImageMagick, and Ghostscript support. When not supported, or if the generation fails, WordPress falls back to previous behavior and saves the attachment without adding image previews to meta. (Quote: Mike Schroder Nov. 15th. 2016)

Primary or Antithetical

Inspiration from Yeat’s “A Vision”

In 1925 the nobel prize winner and author W.B. Yeats published “A Vision”. Here he introduced the dichotomy of Primary and Antithetical. To Yeats there is an opposition between Primary and Antithetical thinking.

We could draw an analogy. Connect Primary with “Drag and drop production”, and Antithetical with “Focus on code / database”. Then you’ll get a suggestive illustration.

WordPress' primary and antithetical phases.
WordPress’ primary and antithetical phases.

Now the extremes would be rare. But you could perhaps imagine a user, that does not understand any code at all. Everything is done via drag and drop. Would such a user be able to make a professional webpage. My answer is clearly: yes.

You could also imagine a user who does not care for the GUI at all. Everything is PHP or SQL to that user. Such a user could build new funcitonality on the core functions of WordPress. Writing code for the sake of code would be possible. But it’s absurd.

Most users are somewhere in between. The more you work with WordPress development, the more you’ll be dragged towards the code side.

The more you can accomplish with a content management system without having to write code, the better it is. But the human race is creative. We often seek something new.

And so the primary drag ‘n dropper depends on the coder – and vice versa.

In my research project I have seen very good multimedia productions with hardly any code. But if your vision transcends the limits of the out-of-the-box WordPress – then you need a skilled coder.

How to use the model

You can use the model in order to visualize the complexity of a WordPress task or solution. Let’s use a Child Theme as a sample:

A child theme
A child theme

A Child Theme will use a given theme – and elaborate on the code. The developer will have to write some code. Depending on the amount of added functionality, widgets, plugins etc. we can place the dot.

In this way we can use the original model by W.B. Yeats in order to visualize the complexity of a WordPress solution.

Another sample: install and use a new theme via the dashboard:

Install a theme via the Dashboard.
Install a theme via the Dashboard.
Visualize Complexity

The model is a visualization of the balance between code and user. Usability is the raison d’être for code.

WordPress = 25% of the Web

WP powers 25% of the web.
WP powers 25% of the web according to W3Techs. Click on the image  if you want to see updated data.

Why you should know WordPress?

Have a look at the statistics. WordPress powers 25% of the web.

Why should you know anything about WordPress? Because it powers 25% of the web. In a not so far future WordPress may power more web pages than the home-hacked ones.

The illustration above demonstrates the present power of WordPress. The green line shows websites that don’t have a CMS. Perhaps they’ve hacked their own system. Who knows what they did.

The rising red line at the bottom of the graph is WordPress. You can see, that the line rises. The red line is what is happening out there. WordPress powers more and more web pages.

The many lines at the bottom of the image are all the other CMSs. As you can see the competition is almost nil. WordPress may not be the best CMS out there. Perhaps one of the geeky CMSs used by 0.00001% may be far better.

Knowing WordPress equals knowing content management. So here you have the statistic argument for knowing WordPress.

Research WordPress – the Official Launch

What You Should Know About WordPress launced at the EAAA.dk
What You Should Know About WordPress launced at the EAAA.dk

So the project is launched on our webpage ( http://eaaa.dk ). For now the text is only available in danish. A very short resume:

The business needs people with solid WordPress knowledge. Many businesses use WordPress as their prime sales or communication channel – what kind of knowledge do you need  in order to meet tomorrow’s challenges with WordPress?

Working on the Interview Guide

During the next weeks I’ll begin interviewing WordPress professionals and users. In general the idea is to explore the knowledge levels needed for WordPress professionals.

The title of this research project is: “What You Should Know About WordPress”. Below the statement you’ll find a question:

– What should you know about WordPress?

Many students have to work with WordPress during internships. The students are connected to supervisors from the business academy. They are also connected to different mentors in the business.

So each interview with a student could perhaps spawn into two or three new interviews.