Skip to content

bug: CodeBlock not works #351

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

Closed
2 tasks done
noahlias opened this issue Feb 27, 2025 · 6 comments
Closed
2 tasks done

bug: CodeBlock not works #351

noahlias opened this issue Feb 27, 2025 · 6 comments
Labels
bug Something isn't working

Comments

@noahlias
Copy link

Neovim version (nvim -v)

v0.11.0-dev-1844+gc3337e357a

Neovim distribution

N/A

Operating system

macos

Terminal emulator / GUI

kitty

Describe the bug

It seems I updated to the latest version of neovim and update the new version nvim-treesitter, it not works as expected.

Image

When I revert this change
nvim-treesitter/nvim-treesitter#7685

It works as expected.

Image

Expected behavior

I hope it works with the latest nvim-treesitter.

Healthcheck output

render-markdown:                     require("render-markdown.health").check()

render-markdown.nvim [version] ~
- OK plugin 8.0.12
- OK neovim >= 0.10

render-markdown.nvim [configuration] ~
- OK valid

render-markdown.nvim [treesitter] ~
- OK markdown: parser installed
- OK markdown_inline: parser installed
- OK latex: parser installed
- OK markdown: highlight enabled

render-markdown.nvim [icons] ~
- OK using: mini.icons

render-markdown.nvim [executables] ~
- OK latex2text: installed

render-markdown.nvim [conflicts] ~
- OK headlines: not installed
- ERROR obsidian: installed
  - ADVICE:
    - Ensure UI is disabled by setting ui = { enable = false } in obsidian.nvim config

Plugin configuration

{
  code = {
    right_pad = 1,
    sign = false,
    width = "block"
  },
  file_types = {
    [2] = "Avante",
    [3] = "copilot-chat"
  },
  heading = {
    sign = false
  }
}

Plugin error log

N/A

Confirmations

  • I have updated this plugin to the latest version using my plugin manager
  • I have provided the text contained in all screenshots as raw text in this issue. This means if there is a screenshot below it is the copy pasted contents of the file in the screenshot. I understand that my issue will be closed if I have not.

Additional information

No response

@noahlias noahlias added the bug Something isn't working label Feb 27, 2025
@MeanderingProgrammer
Copy link
Owner

This should only impact 0.11, since the coneal_lines directive is relatively new: neovim/neovim#31324.

I think 0.11 in general is going to come with some breaking changes for this plugin from a combination of async treesitter parsing & new mark / highlighting features.

I'll create an overall issue to get ahead of these.

@MeanderingProgrammer
Copy link
Owner

Will keep track here: #352

@maxrzaw
Copy link

maxrzaw commented Mar 22, 2025

I think this is related to this, but when using lsp_hover I am having issues that I believe are caused by this plugin.

With this plugin disabled:

Image

With this plugin enabled:

Image

The text in the buffer is:

```lua
(field) cond: boolean = true
```

@lmnzx
Copy link

lmnzx commented Mar 23, 2025

@maxrzaw yeah i am also facing some weird visual issues with lsp hover

Image

can we disable render-markdown for lsp and only have it enables on .md files??

@MeanderingProgrammer
Copy link
Owner

The conceal_lines highlight being on by default is going to cause some strange behaviors.

@maxrzaw I'm actually not sure why you're seeing the raw fenced code block, can you try updating the plugin and see if it still looks like that?

@lmnzx I've got no idea what's going on there, seems like one decoration is being shifted into the incorrect position, potentially related to this: neovim/neovim#33033, but honestly not sure.

Yeah, you can disable this plugin for LSP hover docs with:

require('render-markdown').setup({
    overrides = {
        buftype = {
            nofile = { enabled = false },
        },
    },
})

MeanderingProgrammer added a commit that referenced this issue Mar 28, 2025
## Details

Related issues:

- #351
- #352

This change adds back the code border that currently gets removed by the
default `conceal_lines` highlight that ships with `nvim-treesitter`.

I tried to make this work using virtual lines at first but ran into
quite a few issues with screen offset behavior and was unable to fix the
fact that LSP hover docs are now truncated based on concealed lines
leading to windows that did not take our virtual lines into account.

Ultimately to get around this I've added a new option called `patterns`
which takes a list of directive names & ids and runs the
`disable_pattern` API to turn these off. The default value:

```lua
{
    patterns = {
        markdown = {
            disable = true,
            directives = {
                { id = 17, name = 'conceal_lines' },
                { id = 18, name = 'conceal_lines' },
            },
        },
    },
}
```

Will disable markdown highlight patterns 17 & 18 if they correspond to
a `conceal_lines` directive. There is not any guarantee that the ids
will remain constant and users can override the highlights with their
own which we do not want to break. Hopefully ensuring the ids & names
match will work for most people and I can keep the default value working
with the most common case going forward. This behavior can be disabled
by users by setting `disable = false`.

Since removing these highlight patterns also removes the regular
character level concealing this plugin has been updated to add these for
the delimiter and language nodes itself, rather than relying on the
`nvim-treesitter` behavior.

Disabling patterns can take a while at startup so this instead runs on
just before this plugin actually attaches to a buffer rather than as
part of the startup sequence.

This behavior is specific to `0.11.0` so the logic is appropriately
gated to prevent any older versions from running into errors, we should
still be compatible down to `0.9.0`.

There's also a new `code.border` value called `hide` which is the new
default and applies the `conceal_lines` value to empty fenced code
delimiters. Older versions of neovim will continue to use the `thin`
border style as a fallback. This largely hides the bottom border, but
will also hide the top one if no language icon / name is added or
available.
@MeanderingProgrammer
Copy link
Owner

Should work after: e6c8081

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants