Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Markdown fenced codeblock highlighting broken #2304

Closed
dgrisham opened this issue Aug 14, 2018 · 0 comments
Closed

Markdown fenced codeblock highlighting broken #2304

dgrisham opened this issue Aug 14, 2018 · 0 comments

Comments

@dgrisham
Copy link

dgrisham commented Aug 14, 2018

System Info

Arch Linux, using the kakoune-git package on the AUR

Steps

Open a markdown file (e.g. test.md) and write a fenced codeblock, e.g.

```go
func Test() int {
    return 0
}
```

Outcome

The go code inside of the block is not highlighted as expected. This is the case for all of the languages I've tested (Go, Haskell, and C).

This also happens when I run kak with the -n option to ignore my config (so I know it's not an issue caused by my own kakrc).

Edit: A bit more info -- the markdown codeblock language highlighters are being loaded, as I see them when I type :rmhl shared/markdown/.

Screwtapello added a commit to Screwtapello/kakoune that referenced this issue Sep 18, 2018
Previously, a code block was anything between triple-backtics, including inline
blocks:

        some text ```
        not a codeblock, but highlighted as one
        ``` other text

and even if the closing backticks had the wrong indent:

        ```
        this is a code block containing a triple backtick
            ```
        this is still a code block, but Kakoune thinks otherwise
        ```

Now we use the -match-capture flag to ensure the start and end fences have
exactly the same indent.

Previously, the generic code-block region was defined first, which meant that
it took priority over all the language-specific highlighters. Now we define
the generic code-block highlighting *after* the others, which fixes mawww#2304.

Previously, code-spans were defined as ordinary inline markup, but in Markdown
ordinary formatting doesn't work inside code-spans. Therefore, they are now
regions unto themselves, defined according to section 6.3 of the CommonMark
spec <https://spec.commonmark.org/0.28/#code-spans>, which addresses a comment
on mawww#2111.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant