Importing and literal hash chars in the first column

Hi all -

I have an obscure issue with how MMD import treats hash characters (#) in the first column. MMD treats a hash then a space then something else as a heading, and imports it as a section delimiter. However, I have a need for an MMD import to produce a section with text where a hash-then-space-then-something appears at the beginning of a line. I have the opportunity to escape these cases mechanically before import, but there does not appear to be an escape sequence for this in MMD that is interpolated on Scrivener import. For example, # is not treated as a header, but it appears in the section text as #, not #.

Or another way to put it: MMD import and export are not symmetrical. I can create a topic with hash-then-space-then-something at the beginning of a line then export it as MMD, and when I import the result as MMD it does not recreate the original section, but instead creates two sections. This makes sense given the goals of MMD’s presence in Scrivener (using Scrivener as an editor with one-way export), but it’s inconvenient in my case.

Is there a way to specify a point in the MMD source such that the result upon Scrivener import is a hash-then-space at the beginning of a line in a section?

Is there a way other than MMD to import multiple sections of text into Scrivener that preserves titles, order, and hierarchy? It looks like I could hack the MMD installation with my own scripts but I’d prefer not to. Is there an API for import/export extensions, or AppleScript calls for creating sections?

For the record: I’m trying to import and export another file format used for technical documentation, where "# " appears in code samples and must appear in the first column. I’m using MMD as an intermediate format because there does not appear to be another way to import and export from Scrivener that preserves section titles, order, and hierarchy. Export using this method works great, but import has this one issue. One workaround is to indent code samples on import and dedent them on export, but this requires that I preserve the indentation when editing in Scrivener, which is undesirable.

Thanks!
– Dan

Yes, this sounds like a drawback to using MMD to manage round-tripping sectional documents, but without really using MMD internally. Naturally, if you were using MMD, you would want your code blocks prefixed with a tab or five spaces at all times, to avoid this kind of stuff in MMD itself.

You could try OPML instead. There is both import and export of that in Scrivener. Import is transparent—just drop the file in the Binder and it will expand according to the outline definition. Export is via File/Export/OPML File.... You’ll need Scrivener 2.1 for that last bit.

Preferences for what should be included in the _notes attribute (sounds like you want main text), are located in the Import & Export preference tab.

Excellent! That looks like it’ll work great!

Thanks AmberV!

– Dan