vim-pandoc-syntax icon indicating copy to clipboard operation
vim-pandoc-syntax copied to clipboard

Identifiers and Quoted Literal Blocks Highlighting Errors

Open SndChaser opened this issue 7 years ago • 3 comments

Couple of ugly buggers in the syntax highlighting...

Syntax Highlight Bugs {#ch00-syn-hl-bug}

As above, numbers in an identifier on a header get really wonky highlighting.

But a reference is highlighted correctly.

Quoted literal Blocks Bug {#ch00-quoted-literal-block}

A literal block is highlighted correctly:

This is my test literal block.

However, when said block is quoted, all text thereafter is color as if it were the text of the literal block:

This is my test literal block.

Now this text is highlighted as if it were the literal.

Attaching a screenshot:

2017-04-10-154107_947x1041_scrot

SndChaser avatar Apr 10 '17 20:04 SndChaser

Oh the irony -- forgot to put my example in a literal (code) block:

## Syntax Highlight Bugs {#ch00-syn-hl-bug}

As above, numbers in an identifier on a header get really wonky highlighting.

But a [reference](#ch00-syn-hl-bug) is highlighted correctly.

## Quoted literal Blocks Bug {#ch00-quoted-literal-block}

A literal block is highlighted correctly:

~~~
This is my test literal block.
~~~

However, when said block is quoted, all text thereafter is color as if it were
the text of the literal block:

> ```
> This is my test literal block.
> ```

Now this text is highlighted as if it were the literal.

SndChaser avatar Apr 10 '17 21:04 SndChaser

Adding my comment from Issue #106 which is similar / a variation on this issue:

Any idea when this might be a adressed? I filed a similar problem regarding Block Quotes containing Verbatim Blocks before I realized this problem had been filed.

IMO - it's not valid to ask why someone is using this. It's perfectly standard practice to indent example code in a text book. And it's very much documented as supported by pandoc... Quoting Block Quotations:

A block quotation is one or more paragraphs or other block elements (such as lists or headers), with each line preceded by a > character and an optional space.

And, in the Verbatim Blocks section, text indented by four spaces is treated as verbatim, but:

The initial (four space or one tab) indentation is not considered part of the verbatim text, and is removed in the output.

So, you have to use a Fenced Block either manually indented, or quoted to get the desired effect. From the Fenced code blocks section:

Everything between these lines is treated as code. No indentation is necessary:

Saying that it is not necessary, isn't the same as saying it will be indented (which it isn't), so to have an indented example, you either insert the spaces (or tab) manually, or use a quotation block.

SndChaser avatar Apr 12 '17 20:04 SndChaser

I came to file an issue, found this, and I'm pretty sure it's the same one. Fenced code blocks inside a blockquote break highlighting for the rest of the file. e.g. constructions like the following:

> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean
> eleifend quam sit amet scelerisque viverra. Aliquam facilisis in ipsum
>
> ```python
> if thingy:
>     print("thingy")
> ```
>
> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean
> quis laoreet. Integer fringilla ultrices orci, sed gravida purus

I don't have a screenshot but it looks just like the images upthread.

I noticed that a single backtick after the offending section "turns off" highlighting again, as if it thinks the literal block is actually an inline literal and it's waiting for the closing tick.

andrew-vant avatar Jun 02 '21 21:06 andrew-vant