Writing Markdown in Scrivener, exporting as ebook?

Posts: 1
Joined: Sun Aug 21, 2016 6:39 pm
Platform: Mac

Sun Aug 21, 2016 6:44 pm Post

Hi Everyone,

noob user, just trying to get my head around things and I've run into a problem. Hopefully it is a simply fix.

So I am writing in Markdown/MMD within scrivener. eg. my headings and sub-headings use;

## This is a Second Level Heading


When I tried to compile a document as an ebook, there seems to be no transformation of my headings and other markdown code, so I get the hashtags etc. in the text.

Hopefully I am just missing some tickbox or something - can anyone advise how I go about exporting my markdown text into 'formatted' text in this way?

thank you


User avatar
Posts: 4201
Joined: Wed Aug 21, 2013 4:24 pm
Platform: Mac + iOS
Location: Sweden 64° N

Sun Aug 21, 2016 7:10 pm Post

In my experience the epub compile uses the titles of the documents as headings, not any text within the documents. To convert from MD to something else, I think you need to export/compile from MD to Word or rtf or something like that.
I am a user, writing non-fiction and science, using:
* Mac Scrivener 3 on a Macbook 12”, MacBook Pro 13”, and iMac 27”, running different OS.
* iOS Scrivener 1 on an iPhone 11 Pro, iPad Air 9.7”, and iPad Pro 12.9”, all running the latest iOS

User avatar
Posts: 1246
Joined: Mon Mar 05, 2007 5:22 pm
Platform: Mac
Location: Airstrip One

Mon Aug 22, 2016 3:14 am Post

Scrivener does not have an default output for MMD ➡ EPUB, so you will need to do some kind of post-processing. Can you explain specifically what you are doing at the moment to get to your EPUB?

I would suggest looking at Pandoc, which has a very flexible conversion system for converting raw MMD directly into EPUB (and countless other formats), without needing any intermediary format like RTF. In this kind of workflow you Compile to Multimarkdown, then use Pandoc to generate the EPUB.

Posts: 182
Joined: Tue Apr 29, 2008 5:39 am
Platform: Mac, Win + Linux
Location: Whidbey Island, WA

Mon Aug 22, 2016 4:30 am Post

brianjohns wrote:Hopefully I am just missing some tickbox or something - can anyone advise how I go about exporting my markdown text into 'formatted' text in this way?

I'm using Scriv 2.5 on an earlier Mac system, but I don't think the compile function has changed all that much. Here's an approach to try. Use the MultiMarkdown compile option to create an .html document. Either run that through pandoc (using terminal and the command line "pandoc filename.html -o filename.epub"; --or-- my favorite is to use Calibre (free for download) as a great ePub output and editing program. Add the filename.html file from your Scriv output to Calibre, and then choose 'convert' to ePub. (Note that Calibre also has a very good ePub editor built in for tweaking the ePub file.)

Actually, I've not bothered with .html in Scriv at all; I select the 'compile for Plain Text (.txt) option; that gives me a manuscript text file with my markdown codes intact. (I rename it filename.md.txt to indicate a markdown file). Calibre has a preference setting for "Input" to accept markdown text directly. Use Calibre's 'convert' function to produce an ePub file. Tweak the meta data settings to suit.

(Calibre to accept .md input: go to Preferences-->Input Options-->TXT Input. See the "Structure" boxes. Set Paragraph style: to 'off'; set Formatting style: to markdown. Under "Common" mark the Preserve spaces box. Bottom half of option screen, see the "Markdown" window of check boxes. Check the 'toc' (table of contents) box; the others are optional.)

Note that once you've created an .ePub version in Calibre, you can choose the "Save to Disc" menu (see the little triangle for several output options).

I've had great success with this; the ePubs I produce this way all validate.
On my honor, I will do my best not to do anything unlawful, infringing, disruptive, harmful, threatening, abusive, tortious, defamatory, libelous, lewd, profane, obscene, hateful or otherwise objectionable. Pinky Promise. :mrgreen:

Posts: 12
Joined: Mon Nov 27, 2017 4:19 pm
Platform: Mac

Tue May 28, 2019 9:50 pm Post

Hi everyone,

Instead of creating a new post, I'm digging up this one.
With Scrivener 3, is there a more effective way to write in Markdown and export an .ebook?
I'm also using LateX notation for statistical notations.