Skip to content
● Grav 2.2 is out: 2x faster cold starts and 96% less memory on big sites. Read the announcement →

Modify markdown extra setting

Started by Muut Archive 10 years ago · 0 replies · 652 views
10 years ago

I'm trying to add custom classes to the pre HTML tag using Markdown extra. After reading the fenced code block documentation, it looks like I have to set the code_attr_on_pre variable on the markdown parser to true. There are a few examples here. My 2 questions are

  1. How do I set this variable to true? I've tried a few different places in Grav's own PHP files but haven't gotten it to work. I don't know PHP.

  2. It looks like the behavior of adding classes to pre and code is already enabled to some extent because if I enable markdown extra and type

    JS
    var a = 2;
    

    in markdown, the HTML output is:

    HTML
    <pre class=" language-js">
    <code class=" language-js">
      <span class="token keyword">var</span> a <span class="token operator">=</span> b<span class="token punctuation">;</span>
    </code>
    </pre>
    

    Where was this behavior configured? Thanks!

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 2558 9 years ago
Archive · by Muut Archive, 9 years ago
2 1687 9 years ago
Archive · by Muut Archive, 9 years ago
2 4978 9 years ago
Archive · by Muut Archive, 9 years ago
1 3801 9 years ago
Archive · by Muut Archive, 9 years ago
3 1797 9 years ago