how do I correctly paste multi-line xml snippet to github wiki when using markdown

GithubMarkdown

Github Problem Overview


I am trying to create a github wiki for my project. But I am unable to format a snippet from a Spring beans xml file, into this wiki. What is the proper way to do it? I tried using pre tag, code tag, the multiline code tag etc. But either it is not getting displayed at all or It displays everything in the same line.

Github Solutions


Solution 1 - Github

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.

Solution 2 - Github

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

Solution 3 - Github

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.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAbeView Question on Stackoverflow
Solution 1 - GithubJonView Answer on Stackoverflow
Solution 2 - GithubGlimView Answer on Stackoverflow
Solution 3 - GithubsagnetaView Answer on Stackoverflow