If I have some Markdown like
## My Title A paragraph of content here. code_line(1); // a code comment class MoreCode { } and more text to follow...
How can I set a class on the <code>
block that's generated in the middle there? I want to have it output
<code class=’prettyprint’> code_line(1); // a code comment class More Code { } </code>
But I can't seem to set it. I do not have control over the Markdown code being run, only over the content.
No, Markdown's syntax can't.
You can embed HTML in Markdown. Type literally what you want, with no indent.
<code class="prettyprint"> code_line(1); // a code comment class More Code { } </code>
For the specific case of syntax highlighting following the back ticks at the start of a fenced code block with the language works just about everywhere these days.
```js code_line(1); // a code comment class MoreCode { } ```
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With