You need to tell MultiMarkdown to process Markdown inside HTML blocks. There are a couple ways to do this (as explained in the docs)
First, you can simply mark a block as containing Markdown text by setting markdown=1
on the containing raw HTML element:
<div class="linelist" markdown=1>
* List-item-alpha
* List-item-beta
</div>
Which should give you this output:
<div class="linelist">
<ul>
<li>List-item-alpha</li>
<li>List-item-beta</li>
</ul>
</div>
The second option is to tell MultiMarkdown to process Markdown text within all HTML blocks by using the --process-html
command line option. If you go that route, you can leave out the markdown=1
but be aware that all text in any raw HTML will be processed as Markdown which may give undesirable results in certain edge cases. It is generally best to stick with the markdown=1
method and explicitly ask for Markdown processing only when it is needed.
Finally, your CSS needs to be fixed, even using the markdown=1
trick. The class linelist
points to the div, not the list. While the color change will get inherited by all the div element's children, the display: inline
may not. In fact, display: inline
needs to be applied specifically to the li
:
.linelist ul li {
display: inline;
color: red;
}
Notice the first line; the rule applies to any li
which is a child of a ul
which is a child of any element with a linelist
class.
By the way, your use of a span would not work (even with the CSS fixed) because a span is an inline element and an inline element cannot contain block level elements. While that means your output is invalid, browsers are built to handle the invalid markup. In fact, a browser might (different browsers may so this slightly differant and unpredictable ways) interpret your output (with the span) like this:
<p><span class="linelist"></span></p>
<ul>
<li>List-item-alpha</li>
<li>List-item-beta</li>
</ul>
<p><span></span></p>
Notice that when the browser reaches the end of the block element (the <p>
element in this case), it closes the unclosed span for you. Therefore, your span does not actually wrap the list as far as the browser is concerned and for that reason no CSS will ever apply to the list using the lineline
class. Therefore, you have to use the div, or at least some block level element.
If you are using Discount (as indicated in the update to the question), you can use a Class Block to create a div with a class assigned to it:
> %linelist%
> * List-item-alpha
> * List-item-beta
I'm not real familiar with Discount and this is untested, but according to the docs the above input should give the following output:
<div class="linelist">
<ul>
<li>List-item-alpha</li>
<li>List-item-beta</li>
</ul>
</div>
Just be sure that the MKD_NODIVQUOTE
flag is not set as that disables this feature. I'm not sure about this, but if I'm understanding the docs correctly, the MKD_TAGTEXT
flag may enable parsing of Markdown text inside HTML tags as a second option.