mkhtml.py: writing HTML documents in Markdown

Aristotle Pagaltzis pagaltzis at gmx.de
Sun Jun 8 14:19:39 EDT 2008


* Kragen Javier Sitaker <kragen at canonical.org> [2008-06-08 18:00]:

> On Sat, 7 Jun 2008 17:42:53 +0200, Aristotle Pagaltzis wrote:

> > * Kragen Javier Sitaker <kragen at pobox.com> [2008-06-07 09:40]:

> > > Stylesheeting comes naturally. I just put a `<style>`

> > > element at the top with a few lines inside of it to format

> > > nicely.

> >

> > Note that Markdown ends up wrapping `<link>` and `<style>` in

> > `<p>` tags, arguably erroneously.

>

> What, is Markdown supposed to know that those elements are

> neither block-level nor span-level markup?


In fact it is – or to phrase the statement more appropriately, it
is supposed to know that wrapping such elements in `<p>` tags is
not a useful thing to do. It already avoids wrapping block-level
tags in paragraphs; there is no reason not to extend that list to
also contain all the elements that may appear in the head of an
HTML document, even though they are nominally invalid in the body.


> > Of course, neither tag has any business being in the HTML

> > body; they should both be in the head. Since you’re loading

> > BeautifulSoup anyway, you probably want to include that as

> > fix-up step in your postprocessing.

>

> Yeah, I've been planning to do that, but didn't get around to

> doing it before sending it out. (I also have this theory that

> I'll be a happier person if I don't spend too much time on

> inventing private markup languages, and that makes me perhaps

> unreasonably reluctant to add extra postprocessing steps, even

> when the alternative is ill-formed HTML.)


I agree with that theory, which is why I use Markdown despite the
minor (and a few less minor) things I dislike about it. Attaching
some light postprocessing to Markdown to add support for small
missing bits seems like a much better approach to achieve both
satisfaction and an absence of unhappiness.

I try to write code only when I can’t help it…

Regards,
--
Aristotle Pagaltzis // <http://plasmasturm.org/>


More information about the Markdown-Discuss mailing list