Importing with Multimarkdown Metadata

I have a few hundred poems written in Markdown. Each file contains a standard block of multimarkdown metadata and has a name like poem01.txt

I would like to import these into Scrivener to make a book out of them, but when I do I end up with hundreds of files named things like poem01. I would prefer to have them named with the title provided by the multimarkdown metadata, which would be vastly preferable to manually renaming them all, post-import.

Is this possible?

I have forwarded this for consideration. In the meantime, note the Documents/Set Selected Text as Title menu command, with a keyboard shortcut. That should make things a little less painful, especially if your titles probably follow a predictable pattern, as you can load everything into a Scrivenings session, and then walk through the document with a Regex search query[size=80][[1]][/size]. For example, I tend to follow the colon with a tab character and have two spaces on the end of line (so that meta-data will format nicely in vanilla Markdown, should that ever happen). So for me a regular expression like this would just grab the actual title part of the line:

code.+(?= )$
[/code]

With that, I could alternate between Cmd-G and Shift-Opt-Cmd-T and tear through the whole project pretty quickly.

Notes:[size=80]

  1. If you have no idea what that is, don’t worry, it’s a very advanced search wildcard system. Just copy and paste that into the Find panel and change the “Find Options” matching style to “Regular Expression (Regex)”.
    [/size]

I’ve made some discoveries related to this. I have found that, when the line endings are in the unix format, I can import a multimarkdown file (only one at a time, unfortunately) and have it read the metadata and set the title correctly. However, if those line endings are in the Windows format, Scrivener just treats the file as it would any standard text file, so the metadata comes through as part of the document body. With this, I am able to proceed with my work, but I thought to share the discovery in case it’s a bug.

That’s a very handy regex trick. Thanks for sharing it :slight_smile:

I might not be following what it is you are accomplishing with the Windows line-endings thing, but wouldn’t you get the same effect by keeping the Mac line-endings but just importing everything as .txt drops rather than using the MMD import tool? In other words if you drag 50 plain-text files into the Binder they should just import as raw text, no processing, no matter what their contents are.

Note you may need to add your preferred MMD file extension to the “Plain Text Import Type” tab of the Import/Export preference pane to avoid them coming in as research links.