New utility for MultiMarkdown

06/28/2009 15:37:32

Someone (I forget who — I apologize) had asked about a script to help combine multiple MMD files into one. I wasn’t interested in writing one myself at the time, but something came up and got me into going ahead to create one.

In other words, say you are writing a long, complex document. You may wish to break it up into chunks (chapters, sections, whatever), where each chunk is in a separate document. You then create one “index” document that shows how the other pieces fit together. By changing this index file, you can easily reorganize your document — change the order of chapters, promote a section into a chapter, etc.

The structure of the index file is simple. Each line can contain one filename. Blank lines are ignored. Lines starting with “#” are ignored as comments. To indicate that a file should be “demoted” to increase header levels, simply prefix it with the desired number of tabs (similar to the way the base header level metadata works).

A sample index file looks like:

# This is a comment (ignored)





This indicates that section1.txt and section2.txt should be “children” of chapter1.txt.

Remember, metadata is ignored if it isn’t at the top of a file - when merging files, only the first file can contain metadata. Because of this, it may make sense to have the first file be a separate “metadata.txt” file that contains only metadata….

Let me know what you think.


PS> This utility has been added to the github repository. You can get it now, or wait for the next “official” release - I’m not sure when that might be.

Similar Pages