Markdown speaks to a project I've engaged for nearly a decade. Ever since I cobbled up an Apple Newton keyboard to connect to my Pilot 5000, I wanted to type plain text with formatting for later printing. Class notes and such. Once I wrote a complex WordPerfect script using custom markup. For a while I wrote raw TeX, relying on a macro file to simplify things only a little. Upon examining the output of Markdown and noting the very small set of tags, I thought it might lend itself naturally to this project. The result is a crude shell script that uses Markdown, SmartyPants and tetex (specifically, pdfetex) to generate a pdf file from a Markdown file. At present the script does not support images and its URL handling is pretty crude. I don't even try to do anything with obscured e-mail links. I also deviate from Markdown by: - leaving the plain TeX page numbers - using letters and roman numerals for the second & third nested ordered lists - allowing html comments to pass TeX code by delimiting with the token "TeX": <!--TeX \eject TeX--> This may be pretty far outside the scope of Markdown. Especially the inclusion of TeX commands which could be used to give hints, but also is subject to heavy use (=abuse). Nonetheless I submit the following script for your amusement. The following URL should be available for approximately seven days (until 29 June 2006). I invite comments and improvements. http://www.yousendit.com/transfer.php? action=download&ufid=A18650072B667485 The file you download should be called "md2pdf". --Todd
On Jun 22, 2006, at 10:23 AM, Fosters wrote:> Upon examining the output of Markdown and noting the very small set > of tags, I thought it might lend itself naturally to this project. > The result is a crude shell script that uses Markdown, SmartyPants > and tetex (specifically, pdfetex) to generate a pdf file from a > Markdown file. >I'm amazed that 1. you've written this as a shell script instead of in Perl, Python, Ruby, etc. 2. it's so short. I would suggest you take a look at Fletcher Penney's [MultiMarkdown] [1] system, which I've been using--with a few personalizatons--for about 6 months now. It uses XSLT to transform XHTML LaTeX for later processing. Also, the folks on the [TextMate][2] mailing list have brought [Prince][3] to my attention. I have no experience with it, but it apparently turns XML to PDF directly using CSS. -- Dr. Drang [1]: http://fletcher.freeshell.org/wiki/MultiMarkdown [2]: http://www.macromates.com [3]: http://www.princexml.com