0

Jekyll (kramdown, actually) turns code

```xml
    <code here/>
```

into HTML block

<div class="highlight">
    <pre>
        <code>
            ...
        </code>
    </pre>
</div>

Is this possible to add another class and atributes to this block? I mean to get something like this

<div class="highlight hl-js" data-js="bla-bla">
    <pre>
        <code>
            ...
        </code>
    </pre>
</div>
Varvara Stepanova
  • 3,489
  • 4
  • 22
  • 26

1 Answers1

1

You can put an extension directive after your block, like this:

~~~xml
    <code here/>
~~~
{: .hl-js data-js="bla-bla"}

Documented in http://kramdown.gettalong.org/quickref.html#block-attributes

Pascal Hurni
  • 376
  • 1
  • 7
  • Thank you very much. This is nice. However I meant to add the class and the attribute to all the code blocks automatically but leant that gh-pages do not allow Jekyll plug-ins. – Varvara Stepanova Nov 23 '13 at 20:39