markdown - 使用 markdown (kramdown) 创建 <span> 元素

标签 markdown html

是否可以使用 markdown 创建一个 span 元素?我正在使用 Kramdown 转换器。

谢谢!

最佳答案

根据Markdown syntax spec/documentation ,您应该能够使用纯 HTML <span>元素。此外,Kramdown documentation有一整节介绍一般使用 HTML 元素,以及 <span>特别是。

来自 Kramdown 的文档:

HTML tags cannot only be used on the block-level but also on the span-level. Span-level HTML tags can only be used inside one block-level element, it is not possible to use a start tag in one block level element and the end tag in another. Note that only correct XHTML is supported! This means that you have to use, for example, <br/> instead of <br> (although kramdown tries to fix such errors if possible).

By default, kramdown parses kramdown syntax inside span HTML tags. However, this behaviour can be configured with the parse_span_html option. If this is set to true, then syntax parsing in HTML spans is enabled, if it is set to false, parsing is disabled. It is also possible to enable/disable syntax parsing on a tag per tag basis using the markdown attribute:

  • If an HTML tag has an attribute markdown="0", then no parsing (except parsing of HTML span tags) is done inside that HTML tag.

  • If an HTML tag has an attribute markdown="1", then the content of the tag is parsed as span level elements.

  • If an HTML tag has an attribute markdown="block", then a warning is issued because HTML spans cannot contain block-level elements and the attribute is ignored.

  • If an HTML tag has an attribute markdown="span", then the content of the tag is parsed as span level elements.

关于markdown - 使用 markdown (kramdown) 创建 <span> 元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13685874/

相关文章:

html - 图像库中的内部填充

html - 使用 GetSkeleton 的响应式设计 : how to float right or left by media-type?

azure - 我可以将更大的字体文本添加到 https ://portal. azure.com 仪表板上的 Markdown 小部件吗?

latex - Pandoc 添加了额外的段落分隔符

r - Rmarkdown-运行代码并在文档中显示错误

github - 如何在 Github 中使用语法高亮编写 diff 代码

html - 悬停时将背景图像更改为颜色

visual-studio-code - Visual Studio Code 内置硬包装

html - Polymer 1.0 Cordova,我该怎么做才能改变主页的方向?

html - Vue : select input placeholder option disappears when I add v-model