如何在没有呈现的降价文件中键入html? [英] How do I type html in a markdown file without it rendering?

查看:99
本文介绍了如何在没有呈现的降价文件中键入html?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在一个减价文件中输入以下句子:她说< h1> 很大。我可以在StackOverflow中使用h1附近的三个反引号,但这不适用于.md文件。我还尝试了单一的反引号,单引号,双引号,hashtags,间距,< code> h1< / code> 以及其他所有我能想到的内容。有没有办法做到这一点?

解决方案

您可以转义< 字符替换为& lt; ,这是< 的HTML转义序列。你会被判刑:

 她说& lt; h1>是大

另外,


项目/ markdown /语法#autoescaperel =nofollow noreferrer>原始Markdownspec具有以下内容:但是,在Markdown代码跨度和块内部,尖括号和&符号总是自动编码。这使得使用Markdown很容易编写HTML代码。 (相对于原始HTML,这是写HTML格式的一种可怕的格式,因为你的示例代码中的每一个<和&都需要被转义。)


...这意味着,如果您在将它们置于反引号时仍然收到了标签,则您使用的任何呈现器都不是合规(只要符合要求与该文档),并且您可能想要提交错误。


I want to type the following sentence in a markdown file: she says <h1> is large. I can do it in StackOverflow with three backticks around h1, but this doesn't work for a .md file. I've also tried a single backtick, single quote, double quote, hashtags, spacing, <code>h1</code> and everything else I could think of. Is there a way to do this?

解决方案

You can escape the < characters by replacing them with &lt;, which is the HTML escape sequence for <. You're sentence would then be:

she says &lt;h1> is large

As a side note, the original Markdown "spec" has the following to say:

However, inside Markdown code spans and blocks, angle brackets and ampersands are always encoded automatically. This makes it easy to use Markdown to write about HTML code. (As opposed to raw HTML, which is a terrible format for writing about HTML syntax, because every single < and & in your example code needs to be escaped.)

...which means that, if you're still getting tags when putting them in backticks, whatever renderer you're using isn't "compliant" (to the extent that one can be compliant with that document), and you might want to file a bug.

这篇关于如何在没有呈现的降价文件中键入html?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆