A lightweight markup language is a markup language with a simple syntax, designed to be easy for a human to enter with a simple text editor, and easy to read in its raw form.
Wikipedia.
Textile, Markdown, Multimarkdown and Maruku are all different flavors of lightweight markup languages that i’ve tried so far.
Textile
Nice: Has a lot of formating features. Tables, colors, etc…
Could be better: Text editing experience ends up being almost like editing programming code. does not feel like a text document. Too many strange characters around.
Markdown
Nice: looks a lot better while editing text than textile. Plain text for the most part.Could be better: its too stripped down, no tables for example…
MultiMarkdown
Nice: Its like an extended version of markdown, keeping the basic ideas of markdown and adding several features like: tables, css formating, Supports several output formats: doc, rtf, latex (which can be easily converted to pdf). Supports math formulas.
Could be better: I've had (little) trouble with the older versions of the Multimarkdown Textmate, especially with the bundle preview command, not showing images and depending on the way you include the css, could also not format it correctly. But is the same as Markdown, so does not look like its a MultiMarkdown problem.
Update: Is all working now. Anyway editing the textmate bundle commands is quite straightforward, so is not hard to change/update something.
And i’d like also 1 textmate command for generating a full pdf, but it exists now 2 commands away(1st. Latex and then to pdf), so its not too bad.
Maruku
Nice: Is like an extended Markdown with a called Meta-data syntax, where you have a special syntax to add a table of contents, css classes, source code syntax formatting, put in head, that you want headers numerated, and it does automatically for you. Generates pdf natively. Is all ruby made, thus touching my ruby bias factor :)
Could be better, PDF is not able to include image yet, math generation not ready (in testing/development). The down-part of introducing the special tags is that makes text tiny bit uglier. Also, i didn’t found a way to resize a picture, but should be a way(?)
In Summary: Textile is ugly, Markdown is too simple, Maruku is no there yet, but is promising(especially because is ruby made, will make it a lot easier for me to change when needed)…. So i use now Multimarkdown. I think the MultiMarkdown is more mature and has more features.
MultiMarkdown Tips:
I use a lot Css to format the text is very powerfull.Also another thing i do is, putting in head a path to a local css file, which i can then easily edit and even reference external css paths.
For creating PDf the first step is to generate a Latex file, although Multimarkdown Textmate bundle has this, i just extended a bit, so besides generating a latex file, also saves it. Thus after you just have to do Apple+R, and voilá PDF doc
cd "${TM_MULTIMARKDOWN_PATH:-~/Library/Application Support/MultiMarkdown}"
cd bin
newfile2=${TM_FILEPATH/%.md/.tex}
./multimarkdown2XHTML.pl | ./xhtml2latex.pl > $newfile2
mate $newfile2
Do tinker with the Xslt templates, they can be quite powerful, they can be used to make different templates that generate completely different documents, for example: xhtml xslt: xhtml-toc-h2.xslt on header will make a linkable table of contents.
Makuru Tips:
Because i didn’t found any Maruku textmate bundle, i made the following commands for textmate:
Textmate Commands code for Maruku
Maruku Validate Syntax
#!/opt/local/bin/ruby
require 'rubygems'
require 'maruku'
file_path= ENV['TM_FILEPATH'].split(".").first+".html"
doc = Maruku.new(STDIN.read)
doc.inspect
Maruku to html, for when i need the doc converted into an html fragment, to copy-paste somewhere.
#!/opt/local/bin/ruby
require 'rubygems'
require 'maruku'
file_path= ENV['TM_FILEPATH'].split(".").first+".html"
doc = Maruku.new(STDIN.read)
puts doc.to_html
Maruku create complete html, mostly for preview the doc in a browser.
#!/opt/local/bin/ruby
require 'rubygems'
require 'maruku'
file_path= ENV['TM_FILEPATH'].split(".").first+".html"
doc = Maruku.new(STDIN.read)
a = File.open(file_path, "w")
a.puts doc.to_html_document
a.close
`open #{file_path}`
Maruku create pdf
newfile2=${TM_FILEPATH/%.md/.pdf}
maruku --pdf ${TM_FILEPATH}
open $newfile2
Maruku cleanup, to clean up all files generated by previous commands
pdf_file=${TM_FILEPATH/%.md/.pdf}
html_file=${TM_FILEPATH/%.md/.html}
log_file=${TM_FILEPATH/%.md/.log}
aux_file=${TM_FILEPATH/%.md/.aux}
out_file=${TM_FILEPATH/%.md/.out}
tex_file=${TM_FILEPATH/%.md/.tex}
rm $pdf_file
rm $html_file
rm $log_file
rm $aux_file
rm $out_file
rm $tex_file
And by the way, a big thanks, for all creators and developers of these very useful languages.
4 comments:
Note that the issues i got on textmate preview for multimarkdown, Fletcher T. Penney informed me that they are solved in last version of the textmate bundle.
If you're going straight to PDF from a MMD document, have you tried PrinceXML? For personal use its free, and I find that keeping formatting simply to CSS keeps my life simpler.
After a couple of days playing with PrinceXML, i can only say good things. It seems to work very well.
Thanks for the tip.
I'm one of the developers of MojoMojo, a modern Perl wiki, and we chose Markdown as the default markup language. I put up a comparison of Textile vs. Markdown on the wiki.
Post a Comment