0

Here is a title

Here is a title in another format

Here is a heading

Here is a heading in another format

# What is this?

## And what is this?

Source...

Here is a title
===

# Here is a title in another format

Here is a heading
---

## Here is a heading in another format

# What is this?
===

## And what is this?
---

I can see how markdown is rendered, but I want to know if there is a rule in the spec that gives priority to one form of heading over the other, and how to handle text using both forms at the same time.

4

2 回答 2

0

您的示例不是很“科学”,因为您从未测试过将<h1>​​哈希与<h2>下划线混合并反转会发生什么。

当然,这会因实现而异,但这里是 Kramdown 测试

$ cat foo.md
# mix h1 hash with h2 underline
----------------------------

## mix h1 underline with h2 hash
=============================
$ kramdown foo.md
<h1 id="mix-h1-hash-with-h2-underline">mix h1 hash with h2 underline</h1>
<hr />

<h2 id="mix-h1-underline-with-h2-hash">mix h1 underline with h2 hash</h2>
<p>=============================</p>
于 2013-07-12T02:15:27.653 回答
0

任何地方都没有针对 Markdown 的正式规范(只有许多不同的实现);Jeff Atwood 甚至提出了一个 Markdown 标准应该被形式化,但到目前为止,仍然没有提出一个规范。然后我假设堆栈溢出实现(也许还有其他实现)只是选择优先考虑用下划线编写的标题。

于 2013-07-11T23:31:18.240 回答