Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

Modify markdown extra setting

Started by Muut Archive 9 years ago · 0 replies · 500 views
9 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 1318 9 years ago
Archive · by Muut Archive, 9 years ago
2 915 9 years ago
Archive · by Muut Archive, 9 years ago
2 4044 9 years ago
Archive · by Muut Archive, 9 years ago
1 2920 9 years ago
Archive · by Muut Archive, 9 years ago
3 1104 9 years ago