如何在 GitHub 评论中发布原始的 XML

11

我尝试在Github评论中显示一些原始的XML代码,但是无论我如何尝试,都无法将其显示出来。当我粘贴并保存后,标签被解释掉了,只剩下内容。但该评论旨在展示发送给第三方应用程序所需的内容。

以下是我想插入评论中的内容。

<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:Magento">
   <soapenv:Header/>
   <soapenv:Body>
      <urn:catalogCategoryTree soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
         <sessionId xsi:type="xsd:string" xs:type="type:string" xmlns:xs="http://www.w3.org/2000/XMLSchema-instance">blablaa</sessionId>
         <parentId xsi:type="xsd:string" xs:type="type:string" xmlns:xs="http://www.w3.org/2000/XMLSchema-instance">?</parentId>
         <storeView xsi:type="xsd:string" xs:type="type:string" xmlns:xs="http://www.w3.org/2000/XMLSchema-instance">?</storeView>
      </urn:catalogCategoryTree>
   </soapenv:Body>
</soapenv:Envelope>

这是我向我的同事展示的内容。

soapenv:Header/
soapenv:Body

blablaa
?
?
/urn:catalogCategoryTree
/soapenv:Body
/soapenv:Envelope

有没有办法使我输入的内容显示出来?

1个回答

35

您可以使用三个反引号(```)来在注释中多行引用代码。 如果您想要语法高亮,还可以指定语言:

```xml
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:Magento">
    <soapenv:Header/
    <soapenv:Body>
        <urn:catalogCategoryTreevsoapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
            <sessionId xsi:type="xsd:string" xs:type="type:string" xmlns:xs="http://www.w3.org/2000/XMLSchema-instance">blablaa</sessionId>
            <parentId xsi:type="xsd:string" xs:type="type:string" xmlns:xs="http://www.w3.org/2000/XMLSchema-instance">?</parentId>
            <storeView xsi:type="xsd:string" xs:type="type:string" xmlns:xs="http://www.w3.org/2000/XMLSchema-instance">?</storeView>
        </urn:catalogCategoryTree>
    </soapenv:Body>
</soapenv:Envelope>
```

1
谢谢,我遇到了一个问题,'''<somexml>'''不能正常工作。它需要在单独的行上使用```。 - Geert Schuring

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接