Markdown _and_ Editor Styling Together


I see I can get compilation to take markdown into account by selecting “Convert markdown to rich text in notes and text” in the compilation settings, but I have two problems:

  1. Normal formatting (applied by marking text as italic with the editor button for that, for example) is then ignored. So it seems that text can be interpreted as either markdown, or editor formatted, but not both
  2. _This_ is not shown as italic, but rather as underlined, which is incorrect

An unrelated problem I have is getting the compiled form to show paragraphs. Although the editor shows properly indented paragraphs, the compiled form just shows a big block of text.

That “unrelated” problem is very much related :wink: Turns out markdown interpretation extends to requiring space separated paragraphs if you switch on markdown for compilation too.

1 Like

May I ask why you are mixing Markdown and rich text?

1 Like

I typically advise not bothering too much with that setting unless you really have a strong desire to use Scrivener’s rich text export setup for some reason (perhaps you found a cool ePub format someone made, for example).

In most cases you will get better results by scrolling down to the bottom of the Compile for drop-down and selecting one of the dedicated Markdown options there—and if you don’t have Pandoc installed, get that and restart Scrivener, because that will add more options like DOCX and ePub (and with access to the command-line being used, in the Processing compile format pane, all of Pandoc is available, not just the pre-built ones we provide).

The route you currently trying is very, very basic, is why I suggest going “all in” with Markdown. You’ll get much better results using a real Markdown engine for conversion, and in most cases the output file quality will be superior to anything Scrivener can produce itself anyway.

This approach will also be better for those wishing to blend a little markup with a little formatting—though do be aware you will want to use styles for that, not random direct formatting. That’s a larger topic, and I definitely recommend searching the forum in the Markdown & LaTeX topic area, as it has been heavily discussed over the years. You can absolutely even avoid all Markdown entirely, while still using Markdown generators, or anywhere in between that and pure markup in the editor.

1 Like

That’s a good question :wink:

It’s essentially because I’ve written some of my novel in Scrivener (using native rich text formatting), and now wish to use Obsidian for my first drafts and simply import / cut’n’paste from that into Scrivener.

I guess I could convert everything I have in Scrivener to markdown, but it seems odd that it can’t just handle markdown where it sees it, and still take rich text into account.

It sounds like you’re suggesting compiling to markdown, is that right? I really want to compile from markdown though. I just need it to know about both native formatting and markdown during compilation, but it looks like that’s not possible.

It mostly has to do with how rich text, all by itself, isn’t something easily converted to something that is not about formatting at all, but rather declaring intention, or semantics, to the text. With Markdown it is extremely clear that if you put a > in front of a paragraph, it will be a block quote. But that is not so clear at all in the case of rich text, with there being an indent, and maybe a different spacing style, etc. But that could also be something else, maybe an epigraph, and there are a million and one ways to format a block quote. So how is an algorithm to guess what you meant from the raw RTF formatting?

That’s where styles come in, because styles also declare intention, and we can do things with them in a functional sense, like go into the compile settings and tell “Quotation” styled text to be prefixed with > on each line (or better yet, in the Markdown Options compile format pane, bind that style to the block quote generator).

Converting to style-based text isn’t too difficult, if that’s your concern. The Edit ▸ Select ▸ Select Similar Formatting tool can go a long ways as that will select all matching ranges of text at once, which you can then apply a prepared style to. In this way you can “train” the compiler what such and such an amount of indent, or paragraph spacing, means to you.

I may be a little confused though, because you say you want to integrate with Obsidian, which is a 100% pure Markdown writing environment, but then also say you want to compile from Markdown—and the initial thing you were trying to use is a tool that would remove Markdown and convert it to rich text, which Obsidian won’t have a clue what to do with.

So going off of at least the one part that is clear to me—integrating with a Markdown editor—what you do probably want then is to set your Compile For drop-down to plain “MultiMarkdown” (so you get an .md file), select “Basic MultiMarkdown” as your compile Format, and then for the Section Layouts, set up which parts of your binder outline should print headings and/or text.

At that point you’ll want to customise the Basic MultiMarkdown format a little bit for line breaks because it sounds like you have word processing paragraphs instead of Markdown paragraphs in the editor. That’s an easy fix, as the format is already set up, it just needs a couple of checkboxes enabled to turn it on.[1]

After that, I can’t really provide specific advice, because the rest is what I referred to earlier as “training” the compiler. I would compile initially with what you’ve done so far, and then start going through the original and looking for meaningful rich text that isn’t converting to Markdown and getting things working with styles. Again check the available styles already in that format, and in the Markdown Options tab, both may save you some time on setting up that part of it anyway.

One thing I can recommend is something I do: have a “Stylesheet” document in your binder. Select that, and use the “Current Selection” compile group setting so that is the only thing that compiles. The idea here is to copy and paste the different rich text samples you have into this file, style them, and test the compiler settings against them. Compiling a one or two page sample like this will greatly speed up the experimentation process.

The good news is that once you do this, you’ll be well on your way to have your own personal writing setup that works the way you want.

  1. The instructions provided there are aimed at a LaTeX compile format, but I’ve set up all of the Markdown formats the same exact way. ↩︎

1 Like

Thanks so much for the effort in trying to help :slight_smile:

I have to say though, it really sounds like Scrivener isn’t the right tool for what I’m trying to do, and I think there’s been a bit of a misunderstanding.

What I wanted was to be able to write in Markdown, but also have rich text from the Scrivener editor taken into account. So for example both _this_ and this (italicised by the Scrivener editor) are printed as italic when compiling an ePub, PDF, whatever else.

I wanted to use Scrivener for editing, organising, compiling, and write drafts elsewhere in markdown that I copied over to Scrivener. After looking at Pandoc though, I see it might be best to use Obsidian exclusively (with Pandoc for compilation). I lose some nice features from Scrivener, but it just seems like I’m swimming against the stream there.

And there was a good reason to ask it: I take Markdown notes in Drafts, store them as Markdown notes in DEVONthink, and import them into Scrivener, and they’re converted to Rich Text without any hassle. It’s even easier to get Markdown text with footnotes into Scrivener than rtf files with footnotes. Just not Obsidian’s footnotes, because it has it’s own “flavour”, which is one reason why I don’t use it.

So I use both rich and plain text, but don’t mix them in Scrivener.

How do you import them at that point? They’re still just markdown text, right? Theoretically, I should be able to do the same then?

I think we might be talking past one another a little bit on this matter, and I may not be explaining it very well. You can do that, there is a whole infrastructure for working that way. It might help to give a practical example of precisely what you’re trying to do in a little sample project, with a paragraph or two as demonstration. I can take a look, adjust the settings, show you what I changed, and post an updated version.

But to also reiterate, I really don’t recommend compiling with the native Scrivener converters and that MMD checkbox. It’s not very comprehensive. If you want an ePub, it is way better to use the Pandoc → ePub conversion at the bottom of the menu. If you want PDF (and aren’t a LaTeX user) it is better to use Pandoc → DOCX and generate the PDF with Word or LibreOffice, and so on. There is really nothing to be gained from using the native converters, and they are not, in general, any better than the quality you get from Pandoc and MultiMarkdown.

1 Like

File/Import/Import & Split…