Sean Allred
Sean Allred

Reputation: 3658

Can I keep a list within the paragraph in kramdown?

I need to be able to generate the following structure:

<p>
  Some text in the paragraph
  <ul>
    <li>item<li>
    <li>item<li>
  </ul>
  Some more text
</p>

How can I do this using kramdown? Is it possible? I'm willing to use a reasonable amount of raw HTML if necessary, but nothing that duplicates kramdown functionality.

Upvotes: 1

Views: 543

Answers (1)

Kyle Barbour
Kyle Barbour

Reputation: 1035

HTML doesn't allow lists to be inside paragraphs (for digestible explanations of this, see here and here).

I would guess that the reason you want to do this is because you want the list to inherit the CSS characteristics of the p element. The easiest way to do this in kramdown is exactly what you'd do in the raw HTML - encase the paragraph and the list in another element, and then style that. For example, one way of doing this would be to use this:

<div id = "whatever">

Some text in the paragraph

* item
* item

Some more text

</div>

and then include

#whatever {
    property: value;
}

in your general.css, where those properties mimic those parts of the p element that you want.

Depending on what you have in your list items and what's in the subsequent paragraph, you may need to add kramdown's end-of-block marker (a caret, ^) after the list to get the results you want. See these parts of the kramdown documentation for more.

Upvotes: 1

Related Questions