如何使用`<pre>` tag

时间:2019-02-23 22:40:53

标签: html markdown github-flavored-markdown

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?

1 个答案:

答案 0 :(得分:2)

尝试一下

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

GitHub Flavored Markdown上找到它