I’m looking to extend (break) my grav’s fenced code blocks so I can add a tag or syntax to highlight select portions inside the block. It seems there is nothing available that already does this or similar.
I’m planning on enclosing subsections of a code block in some special tag that will render to HTML <mark>
I understand Grav uses parsedown. Before I get started hacking this myself, I thought I’d ask the community as to where these modifications might best take place, or key files I should be aware of. That sort of thing to best get me started.
Which options have you already explored and why are they not satisfactory to you?
While I couldn’t find anything ready-made to achieve this, I explored using <pre><code> tags to manually create code blocks in the markdown file, which allowed embedding <mark> tags inside the code block. While this worked, it also made it necessary to modify all other <> characters in the code block to their HTML entity codes, which is undesirable as it causes the source markdown to lose its readability.
However, my tests with fenced code blocks and [mark] do contradict yours: <> characters in the fenced code block will not be converted to < or > as shown in your image. I believe this is because you used my snippet with the <pre><code> that had < and >, but those didn’t show in your code snippet before the image. If not that, then it could be a settings difference.
Despite this discrepancy, I am pleased with the results I am getting. Thanks again!