Search code examples
htmlmarkdowngithub-flavored-markdown

How to replicate code block with `<pre>` tag


If we have this block:

```java
  System.out.println("foo");
```

how can replicate the above with <pre> tags?

<pre lang="java">
  System.out.println("foo");
</pre>

is there a class or attribute we can add to the pre tag to tell github markdown to know which language is in there?


Solution

  • Try with this

    <pre>
       <code class="language-java">
          System.out.println("foo");
       </code>
    </pre>
    

    Found it on GitHub Flavored Markdown