Search code examples
jekyllweb-deployment-projectkramdown

Kramdown ID for any element?


I have been learning Jekyll which uses Kramdown as a HTML preprocessor.

What I can't seem to work out is how to assign elements an id.

In Kramdown to created an Ordered List you just use

1. 
2. 

but how on earth do I assign this element an Id for CSS or for linking to?

So e.g.

<ul id="list">
  <li id="1">1</li>

I tried tried

1. item {#}

Solution

  • You can apply IDs and classes when using kramdown, yeah!

    This is a paragraph
    {: #my_id .my_class}
    
    
    # This is an h1 header  {: #my_id}
    

    View more cool stuff you can do with kramdown here on this article

    Hope to have helped! :)