Seriously? Compiling/Exporting to markdown

Hi there,

I have to say I’m pretty annoyed by Scrivener’s export/compiling functions. I just spent over an hour to figure out how to export to Markdown while preserving a simply think like the headings. Everytime I try to export/compile with “Converting Richtext to Multimarkdown” enabled the output result gets a hashtag in front of every paragraph- not just the heading. So basically I can only export/compiling to markdown with no headings at all or everything has a heading. Any help much appreciated as this is sooooo ridiculous for a paid app.

Thanks!

And you can’t even edit posts here? In a forum for a writing app- what a joke!!

Often things are way less simple than you would think. :slight_smile: For example, what is a heading to you? There are probably tens of thousands of different things one might consider to be a “heading”, particularly where it comes to a loosely defined system like RTF that is oriented more toward making documents look pretty, than making them semantic.

So with that in mind, you do need to be pretty specific with Scrivener about your intentions. With the option you are using, it will be looking for the setting in Format ▸ Paragraph ▸ HTML Header Level, which is the closest analogue and is clearly defined. H1 = one hash, H2 = two hashes, and so on.

So with that in mind, you should check and make sure this setting is correct on what you consider to be a heading, and save that into your heading style. You would then need to check what you consider to not be headings, and make sure this menu is set to “Body Text”.

The way you describe things working feels slightly different to me though (and certainly not a common problem—as you can probably see from how buried the menu command is, it’s not something very easily used on accident), so you may be trying to do something I’m not anticipating. If you can demonstrate the issue in a simple checklist that I can follow on my system, that would help a lot.

All of that said, if you’re interesting in using Scrivener to produce Markdown, have you considered just writing in Markdown? I’d say in nearly every way that is more straight-forward than relying upon a word processor style conversion engine to generate Markdown for you.

I write exclusively in Markdown, though I tend to outline to a level of detail that makes typing in headings manually obsolete. The headings and their levels are generated automatically from the outline structure by the compile settings, and react to adjustments made to that structure. Not having to manage hashmarks by hand is one of the (many) reasons I prefer Scrivener over conventional Markdown tools.

And you can’t even edit posts here? In a forum for a writing app- what a joke!!

I suppose I can see the humour, but it’s a simple spam protection layer that has nothing to do with the type of community involved. A common spam bot tactic is to post a seemingly innocuous message (usually strip mined from other places like Reddit, where the question is legitimate in every way) and then a day or two later edit a bunch of junk into it. Since edits do not increment the time stamp in feeds, such forms of retro-spamming can easily go unnoticed.

So you have to establish yourself to a minimum level in order to edit your own posts, just enough to convince the system you aren’t a bot. It really doesn’t take much.

1 Like

Dear AmberV,

Thank you very much for your quick and detailled reply and help!

The Format ▸ Paragraph ▸ HTML Header Level did the trick. Is there any way I can assign those html levels to paragraph styles?

Thank you also for your advice on writing directly in markdown. I’m not sure if I could completely follow your explanation. But I assume you’re just using the binder to assign titles?

The main reason why I not to export to markdown is citation. I’m adding pandoc style citations from my reference manager (Zotero). Those look like [@Ingram_2011_FoodSystemsApproach] and a readable by Markdown applications like Zettlr. The strange thing here is that if I compile I will end up with \ around them like [@Ingram_2011_FoodSystemsApproach] . Do you perhaps know of a solution for this as well?

Thank you very much again for your time and help!
Best wishes,
Hagus

Be nice. =) I am sure you have been frustrated and written something without editing it.

@Hagus: Is there any way I can assign those html levels to paragraph styles?

Absolutely, the HTML header level is an attribute that is saved into paragraph styles (and in fact the default “Heading 1” and “Heading 2” styles are set up as you would expect). Once you get your heading set up, put the cursor anywhere within it, and use the Format/Style/New Style from Selection... command. Alternatively, if you’ve already got one in the works, use the “Redefine” option right below it.

Thank you also for your advice on writing directly in markdown. I’m not sure if I could completely follow your explanation. But I assume you’re just using the binder to assign titles?

It’s a matter of choice, but yes that is one way of doing things. How I most often generate a Markdown document is by using the binder structure, the headings you see in the outline, to generate hashed headings according to nesting depth—so it’s all fluid as I develop the topical outline further, move things around, promote growing sections to chapters, and so forth. Scrivener handles that aspect automatically by default, so all you need to do is set your compile settings, in the middle preview column, so you are using Layouts that include a sample “# Section Title #” line in them. Preview aside, it will adjust the actual number of hashes on the fly for each section.

You can of course also type them in yourself, either exclusively or in combination. Some don’t like to use lots of outline detail, so for example they’ll let the compiler handle levels one and two and then add “### Further Headings” into the text flow itself.

The main reason why I not to export to markdown is citation. I’m adding pandoc style citations from my reference manager (Zotero). Those look like [@Ingram_2011_FoodSystemsApproach] and a readable by Markdown applications like Zettlr. The strange thing here is that if I compile I will end up with \ around them like [@Ingram_2011_FoodSystemsApproach] .

That’s exactly the kind of complication that is introduced by converting WYSIWYG text to Markdown with that option. Since square brackets are special characters, the compiler escapes them all because it presumes you know nothing at all about Markdown and really meant to print a bracket for the reader to see.

Now there is an option right below the Convert rich text to MultiMarkdown setting that you might have missed, that disables that conversion. That might work for you, but just keep in mind that with that option enabled, Scrivener assumes you will be using no Markdown at all. You can blur the line a bit with further configuration, but I would generally say you should only go down that path if you really want to also use Scrivener’s native export formats as well. To be honest we really built this setting for people who don’t use Markdown at all to be able to take advantage of its extended file type capabilities. One could get LaTeX for example, from a fairly standard “word processor” style of working.

As to your larger question, I’m not super familiar with citations in Pandoc, but I would recommend looking up Scrivomatic when you have a moment. It’s a set of scripts designed by a member of the community here, which has the goal of streamlining Pandoc production, similar to how Pandocomatic does, but with further customisations to Scrivener’s compile setup itself. It does have a bit of a separate learning curve, but it may be worth the effort depending on what all you need.

Dear AmberV,

Thank you very much for your message and help! After the initial challenges I managed to set up Scrivener so that it works perfectly now.

Thank you very much again for your time and speedy help!

Best wishes!

Glad to hear it is working better for you now! I hope you find it to be a capable Markdown authoring platform.