I have a piece of text that I would like to compile into MD format. Now Scrivener has a number of default configurations in the Compile settings to create various flavours of MD. None of them work for me.
I have set up a test document with
a paragraph with no style,
a paragraph with no style
a paragraph indented and in italics.
All of Scrivener MD compile options just export all of this as plain text with no markdown formatting (#,* etc)
Is there a MD compile format that does work that can be imported or are there some instructions as to how this should be configured?
Given your test document example here, it doesn’t look like you have any actual Markdown for Scrivener to compile with? There may be a fundamental misunderstanding here, that Scrivener generates Markdown, when it is chiefly designed to offer integration and automation to those who write with Markdown, in Scrivener, using it as they would a Markdown editor. It’s an alternate way of writing with Scrivener, from the ground up, that provides a much cleaner and more semantic workflow.
That said, there is the Convert RTF to MultiMarkdown checkbox, in the general options tab of the compile overview screen, that can convert a limited amount of formatting to Markdown. It probably won’t have anything to do with “indents with italics”, because that means nothing, it’s just fancy looking text, and it’s not going to know what a “title” is. Some people like this way of working though, so it’s worth looking into if you don’t actually like using Markdown to write. I say it is limiting because you not only cannot tap into the full Markdown offering in Scrivener, you also have to limit how much of the “rich text” stuff you use as well. It’s a very constrained approach—but for those that have material that fits within that constraint, who like using buttons and rulers to change the look of their text, but like Markdown output for its clean and precise nature, it can work.
If the notion of writing with Markdown directly appeals to you at all though—take a look at Chapter 21 and start digging in. Scrivener is meant to provide a deep and extensive platform for authoring in Markdown itself. There isn’t much else out there like it, and most things that approach it require you to become a programmer.
@grove — I think it is important in particular to understand the different routes to use MD as specified in §21.4:
Purist — those that wish to physically type markdown into the editor. Any styles will just be for visual convenience and will not contribute to the compiler output! Requires no setup in the compiler.
Hybrid — those who wish to optimally combine Scrivener’s powerful tools with an MD output. My scrivomatic workflow, like many more “advanced” workflows, follows this route. Requires more careful setup in the Compiler, often plugging styles into prefix/suffix rules, but once setup this is way more flexible…
Incidental — those who want to work in RTF but have an (optional) MD route to an output document. Requires some checkbox options set in the compiler.
If you want to deliberately set up styles, you probably need (2). But if all you want is Headings transformed then you should probably utilise the Binder for your section hierarchy (not styles in the editor). With this you may be able to get away with using (3).
I’m now using @nontroppo’s 3rd option to compile to .MD which is opened in Nisus Writer Pro, where a macro turns it into styled RTF (NWP’s native format). The thread below gives the details of where I’m at with it at the moment and includes a Scriv project to play around with; if you don’t use NWP that’s not important as the .MD file is saved anyway, which you can open in whatever app you use for that purpose. All you need to do is: use the Basic Multimarkdown compile format; assign all section types to a single text layout which has a heading; under the gear menu, switch on “Convert Rich Text to Multimarkdown” (I turn off “Escape special characters” so as not to interfere with my Bookends temporary citations … but again that need not concern you necessarily).
Thanks to all these comments which seemed to suggest I was trying to do something Scrivener was not intended for, you have collectively pointed me in the right direction.
I have created a copy of the ‘Basic MultiMarkdown’ compile format. Added some new Styles in the compile settings for the headings. So for example, ‘Heading 1’ adds ## to the Paragraph Prefix/Suffix. All seems to be working rather well. I hav even got a Blockquote paragraph to compile correctly.
There are a couple of little wrinkles, in the Scrivener editor I have to enter an extra blank line between between consecutive paragraphs, but not when it is preceeded by a heading. Ideally I would have added this additional line (CRLF in the output md file) in the compile settings but I could not find a way to get this to work.
I would also like to turn off the Title and Author in the output file. So if anyone knows how to do this, shout.
I’ll post my settings in due course if we can fix these as this is a rather good Scrivener to MD one step workflow.
Regarding the first solution, of using whitespace transformation, that is indeed the best approach. I have written up a short how-to on setting things up. The good news is that all of the Markdown-based compile formats are pretty much all set up and ready to go, waiting for you to enable it.
The good thing about this approach is that it will only impact text that doesn’t have a style applied to it. If you want double-spacing around other style elements you would need to add that formatting to them. Leaving this flexible is good, because some things are better not spread apart, and can even break the syntax, like tables and definition lists. Using styles to mark these special elements that should stay on adjacent lines, even if you don’t do anything with the style at all, is all you need to keep the compiler from adding padding to each line, and subsequently converting to whitespace.
Yikes, I’m getting that hang as well when trying these settings. I recall running into that a few times during beta testing, and could never figure out the trigger, but at this point I have been unable to get around it at all. I’m thus elevating the priority of that ticket.
You may have to, at this point, use a more widespread technique such as:
In the compile overview screen, click on the Replacement tab on the far right.
Create a new row, and Replace\nWith\n\n, using the “Regular Expression” checkbox.
Like I said before, if you use tables or other Markdown that needs adjacent lines, they will need specific repair after compiling as this will double all carriage returns.
Now I have a compile format that allows me to write in Scrivener and create an output file that can be simply pasted into the WordPress Gutenberg editor. It does require that you have ‘character styles’ set up for Bold and Italic and use those in place of the bold and italic buttons on the format toolbar. I also have an additonal style set up called ‘Italic Quote’, this processes as a Quote block in WordPress as the markdown tags that are applied are ‘>*’. Generic MultiMarkdown.scrformat (27.5 KB)
And yes, I would say in general that unless you are writing using pure Markdown-only in Scrivener—such that you could copy and paste the contents of your editor into Sublime Text or Typora with zero loss of formatting—then styles are going to be your best friend all around. Not only can they do basic things like italics, if you prefer that to just typing in the asterisks—they will let you do some stuff that is otherwise very cumbersome without a system like Scrivener on top of Markdown.