Вопрос

I use Markdown to write my training documents, and I convert them to HTML using Pandoc.

I'd like to have a class bullet using the classic * character, and having the logo + (cool!) and - (not cool) using bullets +and -.

Currently I have no differences in the output HTML. How could I add a class depending on the bullet?

Это было полезно?

Решение

To get HTML class attributes out of Pandoc, you have to set these attributes explicitly in the input files. This is supported only for code blocks, and does not work automatically.

To get classes for lists, you need to modify Pandoc to output them.

In src/Text/Pandoc/Writers/HTML.hs, attributes for code blocks are generated in attrsToHtml, called from blockToHtml or inlineToHtml. You would have to extend unordList to generate an attribute and to call attrsToHtml on it.

(The absence of the tag indicates that this might not be the solution you are looking for ...)

Другие советы

If you mean list bullets you can wrap the list in a div with a class and use a corresponding CSS selector:

<div class="styledlist">
+   foo
+   bar
+   baz
</div>

will give you HTML like this:

<div class="styledlist">
<ul>
<li>foo</li>
<li>bar</li>
<li>baz</li>
</ul>
</div>

and you can use a CSS selector like this:

span.styledlist ul { ... }

Not the prettiest Markdown or HTML but it works.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top