Skip to main content
welcome edits to formatting sandbox post
Source Link
starball
  • 29.2k
  • 9
  • 55
  • 140

When rendering posts, a blockquote line followed by a blockquoted pseudo-setext heading underline ending with any character turns those lines into a setext heading.

Here's what the CommonMark spec section on setext headings says:

A setext heading consists of one or more lines of text, not interrupted by a blank line, of which the first line does not have more than 3 spaces of indentation, followed by a setext heading underline. The lines of text must be such that, were they not followed by the setext heading underline, they would be interpreted as a paragraph: they cannot be interpretable as a code fence, ATX heading, block quote, thematic break, list item, or HTML block.

A setext heading underline is a sequence of = characters or a sequence of - characters, with no more than 3 spaces of indentation and any number of trailing spaces or tabs. If a line containing a single - can be interpreted as an empty list items, it should be interpreted this way and not as a setext heading underline.

The heading is a level 1 heading if = characters are used in the setext heading underline, and a level 2 heading if - characters are used. The contents of the heading are the result of parsing the preceding lines of text as CommonMark inline content.

Note how in the section on the setext heading underline, trailing spaces and tabs are allowed, but that's it (not any other characters).

I'm not certain on the "any character" part, but I've tested with non-ASCII characters, so I think that says something.

Here's an example (a MRE of the original one I encountered in the wild (see revision 6)). The following markup:

> I'm a setext heading!?
> -1

Gets rendered as:

I'm a setext heading!? -1

I then went playing in the formatting sandbox. Feel free to constructively edit/add to my post there to do more experimentation.

Here's a list of other things that do reproduce:

> =2
> =a
> =⭐
> ==⭐

But the polar bear emoji (which is an example of an emoji composed of multiple characters joined by the Zero-Width-Joiner) does not produce this issue. Neither do other trailers that are composed of multiple ASCII-range characters:

> =ab
> =abc123
> ==🐻‍❄️

The other weird thing is that these don't get rendered as headings in the editor render preview. For example the first example I showed gets rendered in the editor render preview as if the markup were written as > I'm a setext heading!? -1.

When rendering posts, a blockquote line followed by a blockquoted pseudo-setext heading underline ending with any character turns those lines into a setext heading.

Here's what the CommonMark spec section on setext headings says:

A setext heading consists of one or more lines of text, not interrupted by a blank line, of which the first line does not have more than 3 spaces of indentation, followed by a setext heading underline. The lines of text must be such that, were they not followed by the setext heading underline, they would be interpreted as a paragraph: they cannot be interpretable as a code fence, ATX heading, block quote, thematic break, list item, or HTML block.

A setext heading underline is a sequence of = characters or a sequence of - characters, with no more than 3 spaces of indentation and any number of trailing spaces or tabs. If a line containing a single - can be interpreted as an empty list items, it should be interpreted this way and not as a setext heading underline.

The heading is a level 1 heading if = characters are used in the setext heading underline, and a level 2 heading if - characters are used. The contents of the heading are the result of parsing the preceding lines of text as CommonMark inline content.

Note how in the section on the setext heading underline, trailing spaces and tabs are allowed, but that's it (not any other characters).

I'm not certain on the "any character" part, but I've tested with non-ASCII characters, so I think that says something.

Here's an example (a MRE of the original one I encountered in the wild (see revision 6)). The following markup:

> I'm a setext heading!?
> -1

Gets rendered as:

I'm a setext heading!? -1

I then went playing in the formatting sandbox.

Here's a list of other things that do reproduce:

> =2
> =a
> =⭐
> ==⭐

But the polar bear emoji (which is an example of an emoji composed of multiple characters joined by the Zero-Width-Joiner) does not produce this issue. Neither do other trailers that are composed of multiple ASCII-range characters:

> =ab
> =abc123
> ==🐻‍❄️

The other weird thing is that these don't get rendered as headings in the editor render preview. For example the first example I showed gets rendered in the editor render preview as if the markup were written as > I'm a setext heading!? -1.

When rendering posts, a blockquote line followed by a blockquoted pseudo-setext heading underline ending with any character turns those lines into a setext heading.

Here's what the CommonMark spec section on setext headings says:

A setext heading consists of one or more lines of text, not interrupted by a blank line, of which the first line does not have more than 3 spaces of indentation, followed by a setext heading underline. The lines of text must be such that, were they not followed by the setext heading underline, they would be interpreted as a paragraph: they cannot be interpretable as a code fence, ATX heading, block quote, thematic break, list item, or HTML block.

A setext heading underline is a sequence of = characters or a sequence of - characters, with no more than 3 spaces of indentation and any number of trailing spaces or tabs. If a line containing a single - can be interpreted as an empty list items, it should be interpreted this way and not as a setext heading underline.

The heading is a level 1 heading if = characters are used in the setext heading underline, and a level 2 heading if - characters are used. The contents of the heading are the result of parsing the preceding lines of text as CommonMark inline content.

Note how in the section on the setext heading underline, trailing spaces and tabs are allowed, but that's it (not any other characters).

I'm not certain on the "any character" part, but I've tested with non-ASCII characters, so I think that says something.

Here's an example (a MRE of the original one I encountered in the wild (see revision 6)). The following markup:

> I'm a setext heading!?
> -1

Gets rendered as:

I'm a setext heading!? -1

I then went playing in the formatting sandbox. Feel free to constructively edit/add to my post there to do more experimentation.

Here's a list of other things that do reproduce:

> =2
> =a
> =⭐
> ==⭐

But the polar bear emoji (which is an example of an emoji composed of multiple characters joined by the Zero-Width-Joiner) does not produce this issue. Neither do other trailers that are composed of multiple ASCII-range characters:

> =ab
> =abc123
> ==🐻‍❄️

The other weird thing is that these don't get rendered as headings in the editor render preview. For example the first example I showed gets rendered in the editor render preview as if the markup were written as > I'm a setext heading!? -1.

try to use more correct wording, and add quote of CommonMark spec on setext headings. thanks, @bad_coder!
Source Link
starball
  • 29.2k
  • 9
  • 55
  • 140

When rendering posts, a blockquote line of plain text followed by a blockquote line of reST title markupblockquoted psuedo-setext heading underline ending with any character becomes a titlesetext heading

When rendering posts, a blockquote line of plain text followed by a blockquote line of reStructuredText title markupblockquoted pseudo-setext heading underline ending with any character turns that preceding linethose lines into a titlesetext heading.

I'm assuming that this alternate markup syntax forHere's what the CommonMark spec section on setext headings is loosely basedsays:

A setext heading consists of one or more lines of text, not interrupted by a blank line, of which the first line does not have more than 3 spaces of indentation, followed by a setext heading underline. The lines of text must be such that, were they not followed by the setext heading underline, they would be interpreted as a paragraph: they cannot be interpretable as a code fence, ATX heading, block quote, thematic break, list item, or HTML block.

A setext heading underline is a sequence of = characters or a sequence of - characters, with no more than 3 spaces of indentation and any number of trailing spaces or tabs. If a line containing a single - can be interpreted as an empty list items, it should be interpreted this way and not as a setext heading underline.

The heading is a level 1 heading if = characters are used in the setext heading underline, and a level 2 heading if - characters are used. The contents of the heading are the result of parsing the preceding lines of text as CommonMark inline content.

Note how in the section on reStructuredText (which I know very little about)the setext heading underline, trailing spaces and tabs are allowed, but that's it (as compared to markdown's #-based heading syntaxnot any other characters). Here's the spec page for sections in reStructuredText.

I'm not certain on the "any character" part, but I've tested with non-ASCII characters, so I think that says something.

Here's an example (a MRE of the original one I encountered in the wild (see revision 6)). The following markup:

> I'm a titlesetext heading!?
> -1

Gets rendered as:

I'm a titlesetext heading!? -1

I then went playing in the formatting sandbox.

Here's a list of other things that do reproduce:

> =2
> =a
> =⭐
> ==⭐

But the polar bear emoji (which is an example of an emoji composed of multiple characters joined by the Zero-Width-Joiner) does not produce this issue. Neither do other trailers that are composed of multiple ASCII-range characters:

> =ab
> =abc123
> ==🐻‍❄️

The other weird thing is that these don't get rendered as headings in the editor render preview. For example the first example I showed gets rendered in the editor render preview as if the markup were written as > I'm a titlesetext heading!? -1.

When rendering posts, a blockquote line of plain text followed by a blockquote line of reST title markup ending with any character becomes a title

When rendering posts, a blockquote line of plain text followed by a blockquote line of reStructuredText title markup ending with any character turns that preceding line into a title.

I'm assuming that this alternate markup syntax for section headings is loosely based on reStructuredText (which I know very little about) (as compared to markdown's #-based heading syntax). Here's the spec page for sections in reStructuredText.

I'm not certain on the "any character" part, but I've tested with non-ASCII characters, so I think that says something.

Here's an example (a MRE of the original one I encountered in the wild (see revision 6)). The following markup:

> I'm a title!?
> -1

Gets rendered as:

I'm a title!? -1

I then went playing in the formatting sandbox.

Here's a list of other things that do reproduce:

> =2
> =a
> =⭐
> ==⭐

But the polar bear emoji (which is an example of an emoji composed of multiple characters joined by the Zero-Width-Joiner) does not produce this issue. Neither do other trailers that are composed of multiple ASCII-range characters:

> =ab
> =abc123
> ==🐻‍❄️

The other weird thing is that these don't get rendered as headings in the editor render preview. For example the first example I showed gets rendered in the editor render preview as if the markup were written as > I'm a title!? -1.

When rendering posts, a blockquote line followed by a blockquoted psuedo-setext heading underline ending with any character becomes a setext heading

When rendering posts, a blockquote line followed by a blockquoted pseudo-setext heading underline ending with any character turns those lines into a setext heading.

Here's what the CommonMark spec section on setext headings says:

A setext heading consists of one or more lines of text, not interrupted by a blank line, of which the first line does not have more than 3 spaces of indentation, followed by a setext heading underline. The lines of text must be such that, were they not followed by the setext heading underline, they would be interpreted as a paragraph: they cannot be interpretable as a code fence, ATX heading, block quote, thematic break, list item, or HTML block.

A setext heading underline is a sequence of = characters or a sequence of - characters, with no more than 3 spaces of indentation and any number of trailing spaces or tabs. If a line containing a single - can be interpreted as an empty list items, it should be interpreted this way and not as a setext heading underline.

The heading is a level 1 heading if = characters are used in the setext heading underline, and a level 2 heading if - characters are used. The contents of the heading are the result of parsing the preceding lines of text as CommonMark inline content.

Note how in the section on the setext heading underline, trailing spaces and tabs are allowed, but that's it (not any other characters).

I'm not certain on the "any character" part, but I've tested with non-ASCII characters, so I think that says something.

Here's an example (a MRE of the original one I encountered in the wild (see revision 6)). The following markup:

> I'm a setext heading!?
> -1

Gets rendered as:

I'm a setext heading!? -1

I then went playing in the formatting sandbox.

Here's a list of other things that do reproduce:

> =2
> =a
> =⭐
> ==⭐

But the polar bear emoji (which is an example of an emoji composed of multiple characters joined by the Zero-Width-Joiner) does not produce this issue. Neither do other trailers that are composed of multiple ASCII-range characters:

> =ab
> =abc123
> ==🐻‍❄️

The other weird thing is that these don't get rendered as headings in the editor render preview. For example the first example I showed gets rendered in the editor render preview as if the markup were written as > I'm a setext heading!? -1.

edited tags
Link
bad_coder
  • 28k
  • 8
  • 51
  • 132
added 101 characters in body
Source Link
starball
  • 29.2k
  • 9
  • 55
  • 140
Loading
Source Link
starball
  • 29.2k
  • 9
  • 55
  • 140
Loading