Getting around div tags

John Gruber gruber at fedora.net
Wed Mar 17 22:58:55 EST 2004


Fred Condo <markdown at fredcondo.org> wrote on 03/17/04 at 6:11p:

> One of my MT blog's design uses div tags to separate the main text of 
> the entry from a sidebar and apply different styles and layout to each. 
> Divs, being block-level elements, completely inhibit markdown.

OK, so basically, your post entries look something like this:
    
    <div class="mainarticle">
    foo
    </div>
    
    <div class="sidebar">
    bar
    </div>

And you'd like to use Markdown syntax formatting *inside* the divs,
but you can't because Markdown (purposely) skips each entire div
block.

That's a problem I hadn't anticipated, and I'd be interested to know
if other people do something similar.

My first thought is that what you're doing is turning MT's entry
body field into two fields, as a workaround for the fact that MT
doesn't have a mechanism for adding your own custom fields.

Off the top of my head, it'd be difficult for Markdown to support
this. The idea that Markdown could process text inside HTML blocks
is a huge can of worms. Huge. 

The only thing I can think of is that there could be some sort of
Markdown syntax for adding an HTML block tag which you want Markdown
to process the contents of.

E.g., if you wrote this:
    
    [[div class="whatever"]]
    Blah *blah* blah.
    [[/div]]

Then the "blah blah blah" would get passed through to Markdown for
processing, and Markdown would also turn the `[[tags]]` into real
`<tags>`:

    <div class="whatever">
    <p>Blah <em>blah</em> blah.</p>
    </div>

The `[[tag]]` syntax is just off the top of my head. Maybe `<<tag>>`
would be better. I'd have to give it much more thought.

-- 
John Gruber          |              Daring Fireball
gruber at fedora.net    |    http://daringfireball.net



More information about the Markdown-discuss mailing list