简体   繁体   English

如何在GitHub上使用markdown将Raw HTML粘贴到README.md中?

[英]How to paste Raw HTML into a README.md using markdown on GitHub?

Editing a README.md for a git repository. 编辑git存储库的README.md。 But I want to embed raw HTML into the the readme. 但是我想将原始HTML嵌入自述文件中。 I'm using Markdown, which is an excellent tool. 我正在使用Markdown,这是一个很好的工具。 Yet, the code just keeps showing up as rendered HTML. 但是,代码只是一直显示为呈现的HTML。

How do I keep it Raw? 如何保持原始状态? And formatted like code? 并像代码一样格式化?

Here it is if you're curious: 如果您好奇的话,就在这里:

<!DOCTYPE html>

<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Welcome</title>
</head>
<body>
    <h1>Django Site</h1>
    <hr />
    <p>Thanks for visiting.</p>
</body>
</html>

The heck? 该死的? It works here. 它在这里工作。

I suppose you are on GitHub. 我想你在GitHub上。

GitHub only allows certain HTML elements and attributes inside their markdown: all others are stripped to prevent XSS and defacing. GitHub只允许在其标记中包含某些HTML元素和属性:剥离所有其他元素和属性以防止XSS和污损。

And of course, <body> is one of the forbidden tags as it would make the HTML invalid if present (a body inside a body ) 当然, <body>是禁止使用的标签之一,因为它会导致HTML无效(如果存在)( body内部的body

This is documented at: https://help.github.com/articles/github-flavored-markdown/#html 记录在: https : //help.github.com/articles/github-flavored-markdown/#html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM