在使用 markdown 时,如何正确地将多行 xml 代码片段粘贴到 github wiki

我正在尝试为我的项目创建一个 github 维基。但是我无法将 Springbeans xml 文件中的代码片段格式化到这个 wiki 中。正确的方法是什么?我尝试使用 pre标签,code标签,多行代码标签等。但是它要么根本不显示,要么在同一行中显示所有内容。

64282 次浏览

Replace all the less-than < and greater-than > symbols with &lt; and &gt; respectively, then wrap in <pre> and <code> as before.

not 100% sure if this is the same thing or not, but I just setup some xml snippets in my readme.md and used the

<myxml>
<someElement />
</myxml>

notation.

An old question, however, the solution has changed in the interim. Simply use the ```xml tag on modern mark-down implementations.

```xml
<your XML here>
.```

Example:

<one>
<two>
</two>
</one>

It's that simple and it works far better than embedding the XML as described above.