Getting around div tags

fred markdown at fredcondo.org
Wed Mar 17 23:20:55 EST 2004


On Wed, Mar 17, 2004 at 10:58:55PM -0500, John Gruber wrote:
> 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.
> 

This syntax would definitely solve my (limited) problem, but I'm not
sure what it would mean in a more general application. I haven't yet
looked through the markdown code.

Another approach would be to introduce syntax for "verbatim." Maybe
something like this:

^<div class="this">
blah...
^</div>

Sort of the converse of m4's dnl.


More information about the Markdown-discuss mailing list