How to escape html tags when using MMD?

I am not sure is this MMD issue, but I have some problems getting my writing to a word processor for formatting. Could somenone lend a helping hand perhaps?

My original problem was this: how can I export (or, compile) a document so that the hierarchy remains intact (h1, h2, h3 and so on)? The way Scrivener lets me change text blocks in binder is awesome, but its a bit tedious to compile document, then edit styles one by one. As far as I understand, MMD could help me with this.

I tried to compile document to MMD->RTF, but then the result becomes weirdly formatted. This is because there is lots of html tags that I use in text (yes, I have to: book is about html). Is there a way I could just escape the whole blocks of html data in text?

Like this:

<p>This is example paragraph</p>

Thanks,

/J

Yes, you’ll want to use code blocks (they work just like the ones here on the forum) for all text that needs to be put straight through without any processing done to it. To create an in-line code, use the back-tick character around it, like so: [b]<p>Short example</p>[/b]. For longer code examples, prefix each line with a tab.

But while we are here, you are not going to get very good results with MMD->RTF. That just uses Apple’s textutil application which does nothing fancy at all; it just takes the appearance of the HTML and attempts to replicate that using RTF codes—and it doesn’t do a very good job of it at that. It’s quick and dirty; useful for sending a quick RTF to a colleague or something, but not as a bridge to final word processing and layout. In other words, the final result will not be any better than what you get out of Scrivener already.

You might have better luck just using the HTML output and importing that into Word. I’ve never tried that myself, but at least with the HTML file there are proper section hierarchies.

Update: I just tested HTML -> OpenOffice.org and that retains a lot of the original semantic information with one caveat. OOo doesn’t understand proper XHTML syntax, so you’ll need to delete the [b]<?xml...>[/b] line at the top. This has the side-effect of no longer specifying the text encoding format, so of course you’ll need to add:

<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

Anywhere in the header. So at the very least you could do Scrivener -> MMD/HTML -> OOo -> Word, since OOo has a pretty good Word exporter.

Ah thank you, that back-tick did the trick! Awesome. :slight_smile:

You are right about the RTF capabilities, too. I still haven’t figured out how to export a current table of contents, or how to compile a project so that the header hierarchy remains intact (h1, h2, h3…). These problems are related ofc., because word processors (I use Pages) usually build TOC based on styles.

If I compile the project to html, headers are converted to paragraphs like these:

<p class="p2"><span class="s1">

when they should be formatted as

,

and


Now, it is possible to find&replace those with

and

and so on, but is there a way to modify the export format (-> HTML)? Or am I looking this problem from a wrong direction? I basically have just the need to compile a document that has a TOC and different styles for titles.

But, the problem that I asked about is solved now, at least now I can mark code correctly in Scrivener. Thanks. :slight_smile:

You are getting some odd results, it almost looks like you are using Scrivener’s regular HTML exporter, not the MMD/HTML exporter. Just to verify you should have a set-up similar to the following:

Binder

  1. The outline in the Binder looks like the outline you wish for your book. In other words you might have Parts directly beneath the Draft, and then Chapters beneath the parts, and sections below that.
  2. No titles in the text editor area itself.

Compile Settings

  1. In the Content tab, bottom-right, make sure the “Titles” row is checked all across the board.
  2. Export Format should be “MultiMarkdown -> HTML” NOT “HTML” all by itself.

If you are still getting styled paragraphs with that set-up, then something very odd is happening. If that fixes things for you, you needn’t stick with the above program entirely; that’s just the easiest way to make sure everything is copecetic.

Under the hood, Scrivener is just reading the Binder structure and generating titles in the MMD document using the [b]#[/b] syntax, where one hash is a top-level header, [b]##[/b] is a second-level (chapter) and so forth. A Binder structure of

Draft Part One Chapter One Part Two Chapter Two

Will be converted into:

[code]# Part One #

Chapter One

Part Two

Chapter Two ##[/code]

You can certainly just type these in by hand if you do not want the Binder outline to correlate with the book outline. Doing so is generally much more work as re-organisation between hierarchy levels is no longer automatic, but if you need more flexibility that is the route to take.

The other way to achieve more flexibility is clever usage of the three columns in the Document Elements section. Rather than turning titles on for all three types, experiment with only using automatic generation on one or two types instead of all three. You could, for example, make folders “invisible” in the final book outline.

You can also do this on a per-document basis if you want one or two sections to not be in the final outline. Just check off the “Preserve Formatting” option in the Inspector for that document. Now title generation will be disabled for it. This lets you either hide it in the outline (it will still be exported as text), or supply a custom title by manually putting in a hash-marked line.

Ah bugger, you are right: MMD HTML exporter does give correct output. sigh so many mistakes for a one night, better hit the bed soon. >.<

Thanks for these tips! I will look on to them tomorrow. :slight_smile:

/J