-
Notifications
You must be signed in to change notification settings - Fork 55
How do I create a MultiMarkdown document?
The general concept in MultiMarkdown is that it should be easy for someone to type a plain text file that is human-readable, and then use the MultiMarkdown program to convert that text file into a more complicated computer language such as XHTML or LaTeX. This allows you to create high quality output without having to spend hours and hours fiddling with font sizes, margins, etc.
The first step in learning to use MultiMarkdown is to learn how to use Markdown. MultiMarkdown is an extension to Markdown, and builds off of the basic fundamentals used in Markdown.
I recommend starting by familiarizing yourself with the Markdown basics and syntax pages.
Once you're familiar with the basics of Markdown, it will be relatively easy to pick up the advanced features included in MultiMarkdown.
It is possible to include special metadata at the top of a MultiMarkdown document, such as title, author, etc. This information can then be used to control how MultiMarkdown processes the document, or can be used in certain output formats in special ways.
Title: A Sample MultiMarkdown Document
Author: Fletcher T. Penney
Date: February 9, 2011
Comment: This is a comment intended to demonstrate
metadata that spans multiple lines, yet
is treated as a single value.
Test: And this is a new key-value pair
The syntax for including metadata is simple.
-
The metadata must begin at the very top of the document - no blank lines can precede it.
-
Metadata consists of the two parts - the
key
and thevalue
-
The metadata key must begin at the beginning of the line. It must start with a letter or number, then the following characters can consist of letters, numbers, spaces, hyphens, or underscore characters.
-
The end of the metadata key is specified with a colon (':')
-
After the colon comes the metadata value, which can consist of pretty much any characters (including new lines). To keep multiline metadata values from being confused with additional metadata, I recommend indenting each new line of metadata. If your metadata value includes a colon, it must be indented to keep it from being treated as a new key-value pair.
-
While not required, I recommend using two spaces at the end of each line of metadata. This will improve the appearance of the metadata section if your document is processed by Markdown instead of MultiMarkdown.
-
Metadata keys are case insensitive and stripped of all spaces during processing. This means that
Base Header Level
,base headerlevel
, andbaseheaderlevel
are all the same. -
After the metadata is finished, a blank line triggers the beginning of the rest of the document.
In order to include metadata information such as a title, the XHTML document created by MultiMarkdown must be "complete." This means that it starts with something that looks like:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
If you include metadata in your document (with two exceptions), then you will
generate a complete document. If you don't include metadata, then you will
instead generate a "snippet." The snippet will just include the relevant
portion of XHTML, but will not include the <head>
or <body>
elements.
Metadata that is only intended to affect the way MultiMarkdown process the
output will not trigger a complete document. Currently, this means you can use
Base Header Level
or Quotes Language
and still output a snippet if you
don't include any other metadata.
When generating LaTeX output the same rules apply. Of note, it was not possible to generate LaTeX snippets with MultiMarkdown 2.0 without using a custom XSLT file.
There are a few metadata keys that are standardized in MultiMarkdown. You can use any other keys that you desire, but you have to make use of them yourself.
This value represents the author of the document and is used in LaTeX documents to generate the title information.
This is used to enter further information about the author --- a link to a website, an employer, academic affiliation, etc.
This is used to change the top level of organization of the document. For example:
Base Header Level: 2
# Introduction #
Normally, the Introduction would be output as <h1>
in XHTML, or \part{}
in
LaTeX. If you're writing a shorter document, you may wish for the largest
division in the document to be <h2>
or \chapter{}
. The Base Header Level
metadata tells MultiMarkdown to change the largest division level to the
specified value.
This can also be useful when combining multiple documents.
Base Header Level
does not trigger a complete document.
This can be used to provide a copyright string.
This metadata specifies a URL to be used as a CSS file for the produced document. Obviously, this is only useful when outputting to XHTML.
Specify a date to be associated with the document.
This is used to specify which style of "smart" quotes to use in the output document. The available options are:
- dutch
- english
- french
- german
- germanguillemets
- swedish
The default is english
if not specified. This affects XHTML output. To
change the language of a document in LaTeX is up to the individual.
Quotes Language
does not trigger a complete document.
When outputting a document to LaTeX, there are two special options that change
the output slightly --- memoir
and beamer
. These options are designed to
be compatible with the LaTeX classes of the same names.
Self-explanatory.
You can include raw XHTML information to be included in the header. MultiMarkdown doesn't perform any validation on this data --- it just copies it as is.
As an example, this can be useful to link your document to a working MathJax installation (not provided by me):
xhtml header: <script type="text/javascript"
src="http://example.net/mathjax/MathJax.js">
</script>