[kramdown-users] Alternate Block IAL Placement

Shawn Van Ittersum svicalifornia at gmail.com
Thu Mar 25 19:12:44 EDT 2010

Hi Thomas,

The current placement for block IALs after the block is awkward, since it doesn't match HTML's convention of defining attributes at the top of a block.  It's also problematic for specifying attributes on list (ol/ul) elements, as we've already discussed:

* Item 1

* Item 2

* Item 3
{: is this on the ul, li, or p?}

In HTML, attributes are defined at the top of a block, so each block is introduced by its attributes:

<div id="section1" class="section">

It would be really nice if kramdown could support attributes at the top of a block, in addition to the current syntax:

{: ul attributes}  <= This comes before the ul block, thus pertains to the ul
* {: li attributes } Item 1

* Item 2

* Item 3

For backward compatibility, IALs after blocks would be supported also.  White space would determine the block modified by each IAL.  The syntax rule would be: "If there is a line of whitespace above the IAL, or if there is no preceding block (top of document), then the IAL pertains to the next block; otherwise it pertains to the preceding block."  Examples:

Block A
{: block A attributes}

Block B


Block C

{: block D attributes}
Block D


Block E
{: block E attributes}
Block F
(not sure if this last example should even be legal kramdown syntax, without a line of whitespace between blocks E and F)

The simpler way to think about this is that blocks are already separated by whitespace.  A line of whitespace indicates the beginning of one block and the start of another.  Thus when parsing a document and finding an IAL at the top of a new block, that IAL should be applied to the new block.  If there's an IAL at the bottom of a block, before the whitespace that terminates the block, then that IAL should also be applied to the same block.


More information about the kramdown-users mailing list