I am using Scrivener 2.8.1.2 on MacOS High Sierra 10.12.6
Compiling into multimarkdown includes inline code backticks but not triple backticks for code blocks.
I use the code paragraph style to mark sections of my code. When I compile to native Multimarkdown it does not include the triple backticks that Github Flavored Markdown uses to format code blocks. Does Scrivener provide a native GFM compiler which will include code blocks.
I did define a new inline code style from the default Code style (without the paragraph properties) and those elements were created as backticks when I compiled.
Does Git not use tab-indented code block nomenclature? That’s the method Scrivener will use if you are mapping a style to the Code Block function in the MultiMarkdown Options compile format pane.
While we don’t support every flavour of Markdown out there, the system is designed to be expandable. It is relatively simple to roll your own dialects—especially if you are already using the style system to mark blocks:
If you haven’t already created a format, right-click on the Basic Multimarkdown format and “Duplicate & Edit”.
In the Multimarkdown Options format pane, set Code blocks style to “None”. We want to use our own syntax instead of MMD.
In the Styles pane, select the “Code Block” style (which I presume you are using—if not either rename that one or create one) and in the Prefix and Suffix fields, type in your “```” syntax.
Take care to insert a carriage return after the code in the prefix, and before the code in the suffix, so that they do not fall within the first and last lines of the code block. To insert those into the field use Opt-Return (or copy and paste of course).
In the attached example project, I’ve also shown how you could have a Ruby code block as well as a generic code block.
Your sample project is Scrivener 3 not Scrivener 2.8.1.2. So I cannot open your document.
How would I do the following in Scrivener 2.8.1.2 as your steps are vague…
If you haven’t already created a format, right-click on the Basic Multimarkdown format and “Duplicate & Edit”.
In the Multimarkdown Options format pane, set Code blocks style to “None”. We want to use our own syntax instead of MMD.
In the Styles pane, select the “Code Block” style (which I presume you are using—if not either rename that one or create one) and in the Prefix and Suffix fields, type in your “```” syntax.
Take care to insert a carriage return after the code in the prefix, and before the code in the suffix, so that they do not fall within the first and last lines of the code block. To insert those into the field use Opt-Return (or copy and paste of course).
AmberV’s method does not work with Scrivener 2. The simplest solution is to put the ``` in the text directly. I use Pandoc dialect which for Scrivener 2 I just put things like syntax highlighted code blocks directly, and used formatting presets just to visualise the text in the editor…
Scrivener 3 is much more powerful, as AmberV suggested, as paragraph styles can be converted into custom markup, so you could make “Ruby code Block”, or “Python Code Block” styles and these would be translated into {.ruby} ... and {.python} ... for you. Pandoc can convert from MMD (or any other dialect) to GFM if you wanted, but in your case it shouldn’t be necessary…