MeanderingProgrammer / render-markdown.nvim

Plugin to improve viewing Markdown files in Neovim
MIT License
1.73k stars 38 forks source link

bug: backticks are displayed around code blocks in normal mode #46

Closed sandmuel closed 4 months ago

sandmuel commented 4 months ago

Neovim version (nvim -v)

0.10.0

Operating system

Linux (Fedora)

Terminal emulator / GUI

Ptyxis

Describe the bug

Contrary to what can be seen in the image present in the README, the three backticks are displayed above and below the code block at all times.

Expected behavior

In normal mode the backticks are hidden.

Additional information

Here's what it looks like in normal mode: image Here's what the README shows: preview_1

MeanderingProgrammer commented 4 months ago

Your screenshot is the result of having concealing disabled.

Did you configure the plugin with a different rendered conceallevel? 3 is the default.

sandmuel commented 4 months ago

Nope, just the default config. I have the following located within ./lua/plugins/markdown.lua

return {
    'MeanderingProgrammer/markdown.nvim',
    name = 'render-markdown', -- Only needed if you have another plugin named markdown.nvim
    dependencies = {
        'nvim-treesitter/nvim-treesitter', -- Mandatory
        'nvim-tree/nvim-web-devicons', -- Optional but recommended
    },
    config = function()
        require('render-markdown').setup({})
    end,
}

I have also tried setting it specifically to 3 in case there was some issue with the default, same results though.

return {
    'MeanderingProgrammer/markdown.nvim',
    name = 'render-markdown', -- Only needed if you have another plugin named markdown.nvim
    dependencies = {
        'nvim-treesitter/nvim-treesitter', -- Mandatory
        'nvim-tree/nvim-web-devicons', -- Optional but recommended
    },
    config = function()
        require('render-markdown').setup({
            win_options = {
                conceallevel = {
                    rendered = 3
                }
            }
        })
    end,
}
MeanderingProgrammer commented 4 months ago

Huh, that's strange, I wouldn't expect any difference in what gets concealed.

There's a couple things it could be, I'm seeing that your rust code is not syntax highlighted so it could also be that you do not have highlights enabled with treesitter.

Can you run :checkhealth render-markdown and paste the result.

sandmuel commented 4 months ago
render-markdown: require("render-markdown.health").check()

markdown.nvim [nvim-treesitter] ~
- OK installed
- OK markdown: parser installed
- OK markdown_inline: parser installed
- WARNING latex: parser not installed
  - ADVICE:
    - If you do not want LaTeX support avoid this warning by setting { latex_enabled = false }
- ERROR highlights not enabled

markdown.nvim [executables] ~
- WARNING latex2text: not installed
  - ADVICE:
    - If you do not want LaTeX support avoid this warning by setting { latex_enabled = false }

markdown.nvim [configuration] ~
- OK valid
sandmuel commented 4 months ago

Seems the issue was in fact treesitter lacking highlights, creating ./plugins/treesitter.lua with the following did the trick:

return {
    "nvim-treesitter/nvim-treesitter",
    config = function()
        require'nvim-treesitter.configs'.setup {
            highlight = {
                enable = true,
                additional_vim_regex_highlighting = false,
            },
        }
    end,
}

Shall I close this issue?

MeanderingProgrammer commented 4 months ago

Awesome glad it's working!