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
Title
Heading 1
a paragraph with no style,
Heading 2
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?
You should probably edit the compile settings by right-clicking on the compile present you wish to use, click Edit Format, and then head over to the styles tab and edit them to suit your needs.
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.
Thank you, that fixed that issue. The + and - keys had scrolled off the bottom of the dialog box rather than at the top.
However, the Convert to plain text: Paragraph spacing causes the Compile to hang at 66% and Scrivener finally crashes. I have followed @AmberV 's further instructions but it still hangs and crashes.
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.