js
doajax
middleside
# Introduction to MultiMarkdown # This document is an introduction to [MultiMarkdown][] --- what it is, how to use it, how you can help make it better. This document exists in multiple formats: a plain text document, a pdf, a [Scrivener][] document, etc. Find the format that best suits your needs, or create your own. That is what MultiMarkdown was designed to be used for! [MultiMarkdown]: http://fletcherpenney.net/MultiMarkdown [Scrivener]: http://www.literatureandlatte.com/scrivener.html ## What is Markdown? # To understand what MultiMarkdown is, you first should be familiar with [Markdown](http://daringfireball.net/projects/markdown/ "Daring Fireball: Markdown"). The best description of what Markdown is comes from John Gruber's Markdown web site: > Markdown is a text-to-HTML conversion tool for web writers. Markdown > allows you to write using an easy-to-read, easy-to-write plain text > format, then convert it to structurally valid XHTML (or HTML). > Thus, “Markdown” is two things: (1) a plain text formatting > syntax; and (2) a software tool, written in Perl, that converts > the plain text formatting to HTML. See the Syntax page for details > pertaining to Markdown’s formatting syntax. You can try it out, > right now, using the online Dingus. > The overriding design goal for Markdown’s formatting syntax is to > make it as readable as possible. The idea is that a Markdown-formatted > document should be publishable as-is, as plain text, without looking > like it’s been marked up with tags or formatting instructions. While > Markdown’s syntax has been influenced by several existing > text-to-HTML filters, the single biggest source of inspiration for > Markdown’s syntax is the format of plain text email. [#Gruber][] [#Gruber]: Daring Fireball: Markdown.
## What is MultiMarkdown? # Markdown is great, but it lacked a few features that would allow it to work with documents, rather than just pieces of a web page. I wrote MultiMarkdown in order to leverage Markdown's syntax, but to extend it to work with complete documents that could ultimately be converted from text into other formats, including complete XHTML documents, LaTeX, PDF, RTF, or even (shudder) Microsoft Word documents. In addition to the ability to work with complete documents and conversion to other formats, the Markdown syntax was lacking a few things. Michel Fortin added a few additional syntax tools when writing [PHP Markdown Extra][]. Some of his ideas were implemented and expanded on in MultiMarkdown. John Gruber may disagree with me, but I really did try to stick with his proclaimed vision whenever I added a new syntax format to MultiMarkdown. The quality that attracted me to Markdown the most was its clean format. Reading a plain text document written in Markdown is *easy*. It makes sense, and it looks like it was designed for people, not computers. To the extent possible, I tried to keep this same concept in mind when working on MultiMarkdown. I may or may not have succeeded in this... In the vein of Markdown's multiple definitions, you can think of MultiMarkdown as: 1. A perl script to convert plain text to XHTML 2. The syntax used in the plain text to describe how to convert it to XHTML 3. The system of programs (perl scripts, shell commands, XSLT transforms, php scripts, etc) used to convert plain text to XHTML, and then to convert XHTML into LaTeX, PDF, RTF, etc) [PHP Markdown Extra]: http://www.michelf.com/projects/php-markdown/extra/ ## How do I use MultiMarkdown? # You can use MultiMarkdown in a variety of ways: * As a command-line perl program (the "default" approach) * As a drag and drop application for Mac OS X * As a [TextMate][] [bundle](http://files.fletcherpenney.net/MultiMarkdown.tmbundle.zip) * Within the [Scrivener][] application * In a [blosxom][] or [Oddmuse][] web site [TextMate]: http://macromates.com/ [Scrivener]: http://www.literatureandlatte.com/scrivener.html [blosxom]: http://blosxom.sourceforge.net "blosxom" [Oddmuse]: http://www.oddmuse.org/ "Oddmuse Homepage" ## Where can I find MultiMarkdown? # The MultiMarkdown package can be downloaded: *
Information about MultiMarkdown is available on my web site: *
John Gruber's original Markdown is available at his site: *
Michel Fortin's PHP version of Markdown is at his site: *
## Where can I get more information about MultiMarkdown? # As above, check my web site. Also, you can check out the MultiMarkdown discussion list: *
*
If you questions are specific to Scrivener, you can also browse the Literate and Latte forum: *
# Quickstart Guide to MultiMarkdown # Quick start instructions, for those in a hurry... ## General Instructions ## 1. Download the MultiMarkdown package:
2. Unzip/untar it 3. MultiMarkdown can be run from anywhere, but is easiest when installed in a "common" location: * Windows: * C:\Documents and Settings\All Users\MultiMarkdown * C:\Documents and Settings\<user>\MultiMarkdown * Mac OS X or *nix * ~/Library/Application Support/MultiMarkdown (preferred on Mac OS X) * ~/.multimarkdown * /Library/Application Support/MultiMarkdown (preferred on Mac OS X) * /usr/share/multimarkdown 4. In the "bin" directory, there are a couple of perl scripts designed to take a MultiMarkdown text file and convert to XHTML, or LaTeX, or pdf. These scripts are designed to be able to be run from anywhere. You can leave them where they are, or install them somewhere in your path directory: * mmd2XHTML.pl * mmd2LaTeX.pl * mmd2PDF.pl * mmd2PDFXeLaTeX.pl * mmd2letter.pl 5. To use these files, do something like the following: cd MultiMarkdown bin/mmd2XHTML.pl file.txt where "file.txt" is the MultiMarkdown file you wish to process. "file.html" will be created automatically 6. You can now open `file.html` in your web browser, or do what you like with it. [TextMate]: http://macromates.com/ [Scrivener]: http://www.literatureandlatte.com/scrivener.html # MultiMarkdown Syntax Guide # This is a guide to the markup syntax used in the MultiMarkdown system. ## Metadata ## MultiMarkdown has support for metadata, meaning that you can include information about a document that is not necessarily part of the document contents. To use metadata, simply add information to the top of a Markdown file: Title: A New MultiMarkdown Document Author: Fletcher T. Penney John Doe Date: July 25, 2005 The key is the text before the colon, and the data is the text after the colon. In the above example, notice that there are two lines of information for the Author key. If you end a line with "space-space-newline", the newline will be included when converted to other formats. There must not be any whitespace above the metadata, and the metadata block ends with the first whitespace only line. The metadata is stripped from the document before it is passed on to the syntax parser. While not required, I recommend including two spaces at the end of each line of metadata. In this way, if you pass your document through a regular version of Markdown, the metadata will be properly formatted as plain text with line breaks, rather than joined into a single run-on paragraph. I have included information about some of the "standard" metadata keys --- I welcome feedback and suggestions for additional standard keys that would be useful. If you add keys that are not listed, they are included in the XHTML and LaTeX as custom variables that can still be used if you desire. Remember, XHTML snippets have no means to use metadata. To make use of these features, one must be using `Format: complete` to create full XHTML documents, which can then be processed using XSLT to create other document types. As an example, I use metadata for information that is used to add title, author, keyword, and copyright metadata to PDF's created by MultiMarkdown. **Note**: I make multiple mentions to the use of these keys for LaTeX documents. This is simply because the LaTeX output format currently makes the most use of the metadata information. Any export format could be modified to make use of additional metadata keys. ### Address ### Use this to include the author's mailing address. You can have more than one line in this field --- use two extra spaces at the end of a line, and a newline character will be used in LaTeX. Also used as return address for letterhead and envelope templates. ### Author ### Self-explanatory. I strip this out to provide an author string to LaTeX documents. Also used as the sender for letterhead and envelope templates. ### Affiliation ### Use this to include an organization that the author is affiliated with, e.g. a university, company, or organization. You can include address information here as well, or use the `Address`, `email`, `web`, and `phone` metadata fields. You can have more than one line in this field --- use two extra spaces at the end of the line, and a newline character will be used in LaTeX. ### Base Header Level ### Used by my XSLT script tool to change the default header level. For example, if using the memoir class, you might want a first level header to be interpreted as a chapter, rather than as a part. To do this, simply set `Base Header Level` to `2`. ### Base URL (Deprecated)### Deprecated - WikiWords and WikiLinks no longer supported. ### Bibliography Title ### Change the title used for the references section (e.g. "References" or "Bibliography"). The default value is "Bibliography". ### Bibliography Style ### The name of the BibTeX style you wish to use. ### BibTeX ### This should be the name of a `.bib` file (a BibTeX file used to store references). If you use my xhtml2latex.xslt file, this will convert external citations into markup for BibTeX (see [Bibliography Support][] for more information). You must have `bibtex` installed and working, and the `.bib` file must be in your working directory. ### Chapterstyle ### This is used to designate the `chapterstyle` in LaTeX memoir documents. ### Copyright ### This can be used to provide a copyright string. ### CSS ### Used to specify a CSS stylesheet when creating the complete XHTML output. ### Date ### Provide a date for the document. ### Email ### Use this to include the author's email address. ### Format ### Set to `complete` to indicate that a fully-formed XHTML document should be produced. Such a document is ready for processing by an XSLT tool, such as the XSLT files to convert XHTML into LaTeX. Set to `snippet` to indicate that no `` or other information should be included. This might be useful for generating (X)HTML output ready for pasting into a weblog, for example. **Note**: Some MultiMarkdown tools add this for you (e.g. TextMate using my bundle, and Scrivener.) Duplicating the `Format` key in these programs should not cause a problem --- let me know if you have trouble. ### Keywords ### Provide a list of keywords for the document. I use these to add keywords to PDF's that are produced as well. Keywords can be separated by commas, or placed on separate lines. ### Language ### Currently, the language field is used to specify which version of [SmartyPants] to use. In the future, it may be used for other purposes as well. The languages are written using the English word (e.g. "german" not "deutsch"). [SmartyPants]: http://daringfireball.net/projects/smartypants/ "SmartyPants Homepage" ### LaTeX XSLT ### Used to designate an XSLT file to convert an XHTML document to a LaTeX document. The LaTeX document can then be converted to PDF by `pdflatex`. This key used to be called `XSLT File`. ### Pagestyle ### This is used to designate the `pagestyle` in LaTeX memoir documents. ### Phone ### Use this to include the author's phone number(s). You can have more than one line in this field --- use two extra spaces at the end of the line, and a newline character will be used in LaTeX. ### Recipient ### Used by letterhead and envelope templates. ### Recipient Address ### Used by letterhead and envelope templates. ### Revision ### You can use a string to declare the current version of the document. Displayed on the copyright page when using my memoir XSLT transform. ### RTF XSLT ### This key is used to provide an XSLT file that can alter the XHTML output prior to conversion to RTF. Useful for further customizing the output of MultiMarkdown specifically for the RTF format. I have no plans to create any such files myself, but others may find it useful. *I strongly encourage you to use another route to convert XHTML to RTF. I've had the best results with [Google Docs](htts://docs.google.com/). For non-Mac users, that's definitely the way to go.* ### Subtitle ### Used to provide a subtitle. It ends up in the meta tags, but can be extracted by XSLT for other uses. ### Title ### Used to provide the official title of a document. This is set as the `
` string within the `` section of an HTML document, and is also used by other export formats. ### Use WikiLinks (Deprecated)### Set to `true` or `1` to enable the use of `WikiWords` and `[[Free Links]]`. Requires that you also set `Base URL`. See [WikiLinks][] for more information. ### Web ### Use this to include the author's web URL. ### XHTML Header ### This is used to include raw XHTML information in the header of a document. You can use this field to add information that will be included in the header of the generated XHTML file. This can be CSS formatting data, or javascript code, or just about anything. I am not responsible for getting that code to work. MultiMarkdown just includes it as is. Anything included in this field is inserted, unaltered, in the `` section of the XHTML output. If you do add anything here, the XSLT stylesheet may have to updated to ignore what you added if you want to convert to LaTeX. Let me know what you add, and I can consider updating the XSLT stylesheet to ignore it. Currently it ignores `