Export as Markdown – limited

I am using .rtf in Scrivener and then exporting as Markdown (.mmd) with all the options checked, so rich text should be converted to Markdown.

I am finding that basic formatting e.g. bold, itals, unordered lists ‘appear’ in Markdown, and links are translated correctly.

However, Heading 1, Heading 2 etc styles do not appear as # Heading1 or ## heading 2. Instead they appear as paragraph text in bold.

Any suggestions?

I believe I had the same experience.

I reverted back to just writing Markdown within Scrivener (easy enough), but it would be nice if headings were properly converted to markdown.

Have you tried using Compile format editor ▸ Styles ▸ prefix/suffix to set the # markup for headings?

Or just use the Binder titles where this is achieved automatically?

I’d say “limited” is a little harsh - after all, Scrivener 3 converts hyperlinks, document links, bullets, tables, bold, italics and more to MultiMarkdown format. It’s true that currently headings are ignored, because it is built around the assumption that you will use binder titles as the headings. nontroppo’s suggestion of adding a prefix to the heading styles is a good solution for this for now, but for the next update I’ve made it so that paragraphs with HTML header levels assigned will add the necessary hashes on export or Compile.

All the best,
Keith

Keith,

That sounds great re: including headings in a future version!

Hi Keith, just to say that if you do this automatically, could this still be overriden manually using prefix/suffix? I ask because I prefer to use Pandoc’s stricter rules (blank line before #, space between # and text), and trailing octothorpes. Note MMD also works with these rules, even if it doesn’t enforce them (I think).

EDIT: as a small aside, the UI text box resizes when you use a return in it (blank line before a heading):
Screen Shot 2017-11-26 at 10.47.10_SMALL.png

Yes, given that the feature requires the HTML Level setting, to parse what you want in terms of how many hashmarks to use (rather than guess off of a style name), you can thus effectively opt out the behaviour by using heading styles that do not have that Paragraph/HTML Header Level set.

So when you look at it that way, it’s not even a style-based approach (though that would certainly be the most convenient delivery mechanism). If you select an un-styled paragraph in the editor and set it to H4, then upon compilation with the RTF->MD option set, the paragraph would be wrapped in “#### ” … “ ####”.

OK, good to know thanks!

Hi nontroppo, could you direct me to the Compile Format Editor you showed?

I think this is what you want:

File > Compile > Formats > Right click the relevant format and choose either Edit Format or Duplicate & Edit Format > Styles

The automatic inclusion of the hashtags would be great!
Any chance we could get them through the export feature too?

Bridey is correct, I’ll just add §24.5 of the user manual is where you can find more details on its use.