Bug: INS/DEL in block context (1.04b)

Jelks Cabaniss jelks at jelks.nu
Sun May 2 16:16:00 EDT 2004


On April 28, Joshua Herzig-Marx wrote:
> many of my text documents start with the following text: 
>    <link rel="stylesheet" type="text/css" 
>    media="print" href="print.css" /> 
> or something similar. Now, I realize that markdown isn't
> creating a full HTML document, but it is handy and ensures
> taht everything will look pretty when viewing the output in
> IE. However, the <link /> tag is getting wrapped in <p>
> tags. 


Then May 1st, Ron Hale-Evans wrote:

> ...why does this:
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
> <HTML> ...
> ...turn into this?
> <p><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"></p>
> <p><HTML> ...

> I thought Markdown was smart enough not to enclose block-level HTML
> elements in paragraph tags.
 
Short answer:  focus on *inside* the `<body>`.  Markdown doesn't concern
itself with the Doctype Declaration or `<head>` metadata.  Nor could it --
all it knows is the authored text it's being fed, not assertions residing in
your mind *about* that text.

`<link>`, `<title>`, `<meta>`, `<base>`, etc. are all such assertions, but
the important point is that you will never find those elements inside the
`<body>` of a valid XHTML document.  Markdown is just calling your attention
to this.  :)

(These types of questions are coming up often enough that the subject
probably warrants minimally addressing in the online docs.)

> Is Markdown only intended for blogging, in which postprocessing is
> done by the blog software and all the foofarra of standalone HTML
> documents is not needed?  

Well, *I* don't blog and I use Markdown every day.  I've implemented it in a
"Clip" in Notetab (my Windows text editor):  if there is selected text, my
clip runs Markdown.pl on that text only.  Otherwise, it runs Markdown on the
entire document, wraps the result in `<body>...</body>`, inserts the XHTML
1.0 Strict Doctype Declaration and a skeletal `<head>` section at the top
(in the process making the `<title>` contain the contents of the first
`<h1>` -- if one exists), then adds the closing `</html>`.  It then runs
HTML Tidy on it.

Any "text2html" style program implementing Markdown would probably work
similarly.


/Jelks





More information about the Markdown-discuss mailing list