Markdown 中的嵌套引号无法正常工作

发布于 2024-12-15 09:36:13 字数 441 浏览 7 评论 0原文

我对 Markdown 中的引号有问题。 当我有这样的东西时:

    text
    > quoted text
    > > deeper layer
    > > > even deeper layer

它工作正常。但是当有一个层不那么深的答复时:

    > quoted text
    > > deeper layer
    > > > even deeper layer
    > > from second layer again
    i see your point there

它没有发挥应有的作用。它只是将引用不那么深的文本附加到当前的块引用层。

我怎样才能获得当前行之前的块引用标签的引号层?

I have problem with quotes in markdown.
when i have something like this:

    text
    > quoted text
    > > deeper layer
    > > > even deeper layer

it works fine. but when there is a reply with a layer not so deep:

    > quoted text
    > > deeper layer
    > > > even deeper layer
    > > from second layer again
    i see your point there

its not working as it should. its just appending the not so deeply quoted text to the current layer of blockquote.

How can i just get the layer of quotes of blockquote-tags before the current line?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

吐个泡泡 2024-12-22 09:36:13

您是否尝试过在三级文本和随后的二级文本之间添加一个空行?

某物

一级回复

<块引用>

二级回复

<块引用>

三级回复
这是您在示例中显示的二级回复输入方式。


其他的东西

一级回复

<块引用>

二级回复

<块引用>

三级回复

这是一个二级回复,按照我建议的方式输入,上面有一个空行。

看起来像这样:

Something else
> Level-one reply
> > Level-two reply
> > > Level-three reply

> > This is a level-two reply input the way I suggest, with a blank line above it.

编辑

由于这仍然是一个悬而未决的问题,为什么不尝试跟踪当前连续的 > 数量。当遇到较少的行时,在其前面插入一个空行。

Have you tried putting a blank line in between the level-three text and the level-two text that follows?

Something

Level-one reply

Level-two reply

Level-three reply
This is a level-two reply input the way you show in your example.

Something else

Level-one reply

Level-two reply

Level-three reply

This is a level-two reply input the way I suggest, with a blank line above it.

Which looks like this:

Something else
> Level-one reply
> > Level-two reply
> > > Level-three reply

> > This is a level-two reply input the way I suggest, with a blank line above it.

EDIT

Since this is still an open issue, why don't you try keeping track of the current number of >'s in a row you have. When you encounter a line with fewer, insert a blank line before it.

薔薇婲 2024-12-22 09:36:13

始终在每个回复级别之间添加一个“空白”行。

(我所说的“空白”行实际上是指:没有任何文本的行,但包含与之前引用级别相同数量的 >。)

例如:

> Level one.
>
> > Level two.
> >
> > > Level three.
> > >
> > Level two again.
Level two continues as hard-wrapped paragraph.

上面是由本网站的 Markdown 渲染的解析器/渲染器如下,符合您的需求:

一级。

<块引用>

二级。

<块引用>

三级。

再次进入二级。
第二级继续作为硬包装段落。

如果您有硬包装的段落(如您的示例中所示),则始终包含空行是更正确、更统一的方法。有关更多详细信息,请阅读我的其他答案下的评论,复制如下:

@allo:回复“我不太确定该行为是否是一个 Markdown 错误。”

这不是一个错误,至少根据 daringfireball.net。特别是,请参阅页面中的这一部分:“Markdown 允许您偷懒,只将 > 放在硬包装段落的第一行之前”。


Always add a "blank" line between each reply level.

(By "blank" line, I actually mean: a line with no text, but containing the same number of > as the previous quote level.)

For example:

> Level one.
>
> > Level two.
> >
> > > Level three.
> > >
> > Level two again.
Level two continues as hard-wrapped paragraph.

The above is rendered by this website's Markdown parser/renderer as the following, which matches what you want:

Level one.

Level two.

Level three.

Level two again.
Level two continues as hard-wrapped paragraph.

Always including a blank line is the more correct, more uniform approach if you have hard-wrapped paragraphs (like in your example). For more details, read my comment under the other answer, reproduced here:

@allo: In reply to, "I'm not quite sure, if the behaviour is a markdown bug."

It is not a bug, at least according to the syntax defined at daringfireball.net. Particularly, see this portion in the page: "Markdown allows you to be lazy and only put the > before the first line of a hard-wrapped paragraph".

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文