Skip to content
● Meet Grav Guard: keep every Grav site you run secure and up to date, all from one place. Free for up to 3 sites. Read more →

Modify markdown extra setting

Started by Muut Archive 10 years ago · 0 replies · 728 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 Muut Archive, 10 years ago
1 672 1 week ago
Archive · by Deleted User, 9 years ago
0 3042 9 years ago
Archive · by Muut Archive, 9 years ago
2 1983 9 years ago
Archive · by Muut Archive, 9 years ago
2 5336 9 years ago
Archive · by Muut Archive, 9 years ago
1 4134 9 years ago