[英]markdown=“1” not working inside the p tag
There is no markdown
HTML attribute. 没有
markdown
HTML属性。 Maybe you're working in some framework that is supposed to add that capability, and it's not working right? 也许您正在某个应该添加该功能的框架中工作,但是它不正常吗?
markdown="1"
is a common, albeit non-standard, method to alter the behavior of a Markdown parser. markdown="1"
是一种通用的方法,尽管它是非标准的,但可以改变Markdown解析器的行为。 Specifically, standard Markdown ignores Markdown syntax wrapped inside block-level HTML tags. 具体来说,标准Markdown会忽略包装在块级HTML标签中的Markdown语法。 With an appropriate extension enabled, adding
markdown="1"
as an attribute to the wrapping HTML tag will instruct the Markdown parser to not ignore Markdown syntax within the tag. 启用适当的扩展名后,向包装的HTML标签添加
markdown="1"
作为属性将指示Markdown解析器不要忽略标签内的Markdown语法。 However, you need to be using a Markdown implementation which includes support for the feature and enable the feature if it is not enabled by default. 但是,您需要使用Markdown实现,其中包括对该功能的支持,如果默认情况下未启用该功能,请启用该功能。
For example, PHP Markdown Extra documents the feature this way: 例如,PHP Markdown Extra以这种方式记录了该功能:
Markdown Extra gives you a way to put Markdown-formatted text inside any block-level tag.
Markdown Extra提供了一种将Markdown格式的文本放入任何块级标签内的方法。 You do this by adding a
markdown
attribute to the tag with the value1
— which givesmarkdown="1"
— like this:您可以通过将
markdown
属性添加到值为1
的标记(标记为markdown="1"
)来实现此目的,如下所示:<div markdown="1"> This is *true* markdown text. </div>
The
markdown="1"
attribute will be stripped and<div>
's content will be converted from Markdown to HTML.markdown="1"
属性将被剥离,<div>
的内容将从Markdown转换为HTML。 The end result will look like this:最终结果将如下所示:
<div> <p>This is <em>true</em> markdown text.</p> </div>
Note that the Markdown parser strips out the markdown="1"
attribute as it is not a valid HTML attribute. 请注意,Markdown解析器会剔除
markdown="1"
属性,因为它不是有效的HTML属性。 It only has meaning for some "extended" Markdown parsers. 它仅对某些“扩展” Markdown解析器有意义。
For completeness, the original Markdown rules explain that Markdown syntax is ignored when wrapped in HTML: 为了完整起见,原始的Markdown规则解释了将Markdown语法包装在HTML中时会被忽略:
Note that Markdown formatting syntax is not processed within block-level HTML tags.
请注意,Markdown格式语法不会在块级HTML标记中处理。 Eg, you can't use Markdown-style
*emphasis*
inside an HTML block.例如,您不能在HTML块内使用Markdown样式
*emphasis*
。
That being the case, the following Markdown: 既然如此,下面的Markdown:
<div>
This is *true* markdown text.
</div>
Would generate the following HTML when passed through a Markdown parser: 通过Markdown解析器时,将生成以下HTML:
<div>
This is *true* markdown text.
</div>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.