Homer Wolfe's Markdown Notes
Do you like writing HTML by hand? Probably not.
Markdown is like email "formatting", with stars for bullets, > for quoted text, etc. Then there's a
perl script![](/twiki/pub/TWiki/TWikiDocGraphics/external-link.gif)
that converts it to HTML.
Then, to make the HTML pretty, you just add
The Markdown CSS File![](/twiki/pub/TWiki/TWikiDocGraphics/external-link.gif)
. Of course, you can also add your own CSS stuff, such as a HTML boilerplate to the top and bottom:
top:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<link href="/path/to/markdowncss/markdown.css" rel="stylesheet"></link>
<style>
body {max-width: 45em;}
ul, ol {
padding: 0em;
margin: 1em;
}
</style>
</head>
<body>
bottom:
</body>
</html>
The body max-width stuff makes the text wrap after a reasonable line length. The ul,ol padding and margin make lists indent sort of normally (markdowncss makes them indent weirdly).
Example
Save into a text file
Title
==========================
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce faucibus consequat dolor, sit amet feugiat magna tincidunt id.
> Praesent nec magna nunc, vitae eleifend turpis. Vivamus sit amet dolor dui, eu mollis est. Duis porta placerat libero vitae facilisis.
> Nullam eget consequat lacus. Phasellus eu lectus dui. Integer leo velit, auctor in sollicitudin in, convallis ac neque. Suspendisse
> tellus nibh, pharetra eget scelerisque mattis, posuere a dui. Suspendisse velit justo, dignissim ut tempus nec, cursus id diam.
* Donec vel est sit amet metus accumsan pharetra vitae ac neque. Nulla ut orci purus.
* Aliquam ac nunc nibh, et vulputate felis. Etiam porttitor nunc in turpis pretium malesuada.
----------------------------------------------------------------
![text](path/to/figure.png "alt-text")
And then run
perl Markdown.pl --html4tags foo.text > foo.html
This will make a really stupid looking HTML page. Then just do this:
cat Header.html foo.html Footer.html > bar.html.
As long as your markdown.css file is visible,
bar.html
will look totally rad.
Makefile
all: index.html
index.html: index.txt Header.html Footer.html
@rm -f index.html index.tmp
@perl ~/bin/Markdown.pl --html4tags index.txt > index.tmp
@cat Header.html index.tmp Footer.html > index.html
@rm -f index.tmp