nested Quotes in Markdown are not working correctly
Asked Answered
S

2

6

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?

Soteriology answered 13/11, 2011 at 17:4 Comment(0)
G
1

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".

Giaour answered 17/12, 2023 at 22:33 Comment(1)
Looks like intended behavior by the markdown spec is breaking with older conventions. Adding blank lines is probably the easiest solution.Soteriology
V
3

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.

Verst answered 14/11, 2011 at 16:20 Comment(6)
yeah, that is a possible workaround, but then i would need to parse it before, detect when a quote has lower level and add the blank line before running the markdown parser. I'm not quite sure, if the behaviour is a markdown bug, or if markdown is just not what i'm looking for, when formatting messages. The formatting rules are quite nice, but the quoting is not intuitive, when it comes to e-mail like quotes as in my example.Soteriology
It may be the case that the implementation of Markdown you are using does not meet your needs. There are many implementations out there, so you might be able to switch to another -- or modify your own -- before resorting to new pre-formatting logic.Verst
i am using python django, with the python implementation. i may write a own templatefilter, which first splits lines, detects indention level and inserts newlines, then calls the original markdown filter. but i'm not sure if this is the best way to do it. It may cause problems later on.Soteriology
No, i'm still having this as an open bug. Maybe i will add some logic adding blank lines, but it would be cool to have a clean way to do it.Soteriology
current status: no progress, but at the most active place i decided to use bbcode instead. If somebody knows a nice way to fix the markdown, i would appreciate an answer, anyway ;).Soteriology
@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".Giaour
G
1

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".

Giaour answered 17/12, 2023 at 22:33 Comment(1)
Looks like intended behavior by the markdown spec is breaking with older conventions. Adding blank lines is probably the easiest solution.Soteriology

© 2022 - 2024 — McMap. All rights reserved.