Varvara Stepanova
Varvara Stepanova

Reputation: 3569

Tune output markup for code block in Jekyll (kramdown)

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>

Upvotes: 0

Views: 875

Answers (1)

Pascal Hurni
Pascal Hurni

Reputation: 376

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

Upvotes: 1

Related Questions