Compiling into GitHub Flavored Markdown

Posts: 1
Joined: Sat Jul 01, 2017 10:11 am
Platform: Mac

Thu Dec 07, 2017 1:35 pm Post

I am using Scrivener 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.

User avatar
Posts: 20612
Joined: Sun Jun 18, 2006 4:30 am
Platform: Mac + Linux
Location: Santiago de Compostela, Galiza

Thu Dec 07, 2017 4:24 pm Post

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:
  1. If you haven’t already created a format, right-click on the Basic Multimarkdown format and “Duplicate & Edit”.
  2. In the Multimarkdown Options format pane, set Code blocks style to “None”. We want to use our own syntax instead of MMD.
  3. 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.

A GitHub compile format might not be a bad idea though. Hmm. :)
(108.42 KiB) Downloaded 1 time
Ioa Petra'ka
“Whole sight, or all the rest is desolation.” —John Fowles