Headers
David Engel
engel5 at engel5.net
Thu Feb 3 11:51:00 EST 2005
One of my most missed features of Textile (when I was using it with Movable Type) was the ability to offset the headers which might be in the final HTML fragments, i.e., I could put the codes for level 1 headers in the entry and MT/Textile would adjust the `<H1>` tags to whichever level I deemed appropriate because of the template that the entry would go into.
Would this be an easy addition to Markdown.pl proper? Does it make sense? It does to me due to the fact that Markdown.pl has never been meant to generate a finished (X)HTML document - there no HTML, HEAD, or BODY tags. In my thinking, it does not mean a change to the syntax, just an optional configuration which would convert the final HTML from `<h1>...</h1>` to the level chosen. This is a feature I don't see in the code which I think would be beneficial for any use of Markdown (MT, BBEdit, Blosxom, standalone).
If not, I have the ability to run a post process cleanup in Perl for my Blosxom blog, and I was wondering if any Perl God(ess)s could let me know if the following seems to be going in the correct direction:
$headaddition = 2; # want to add 2 to any <h1> through <h4>
# some silliness to indicate that $text has been through Markdown
$text = Markdown($text);
#...
$text =~ s/(<?\/h)([1-4])(>)/$1($2+$headaddition)$3/g;
Does that look like it will work?
David Engel
---------------------------------
Now online at http://aym.engel5.net
More information about the Markdown-Discuss
mailing list