MeanderingProgrammer / render-markdown.nvim

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

bug: backticks not being concealed by default #89

Closed gennaro-tedesco closed 3 months ago

gennaro-tedesco commented 3 months ago

Neovim version (nvim -v)

NVIM v0.10.0 
Build type: RelWithDebInfo LuaJIT 2.1.1713484068

Operating system

MacOs

Terminal emulator / GUI

iTerm

Describe the bug

More than a bug a request for clarification: I am running the plugin with default settings, however I cannot reproduce the visuals that appear in your demo screenshots, in particular concealing of backticks isn't show (the backticks still are).

See screenshot above: I have copied&pasted a portion of your README.md, expecting it to automatically render as in the gifs, however the concealing both for inline and block code isn't correct (or am I mistaken)?

Screenshot 2024-07-23 at 15 08 48

Expected behavior

Backticks do not appear when concealed.

Healthcheck output (:checkhealth render-markdown)

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

markdown.nvim [neovim version] ~
- OK Version >= 0.10

markdown.nvim [configuration] ~
- OK valid

markdown.nvim [nvim-treesitter] ~
- OK installed
- OK markdown: parser installed
- OK markdown_inline: parser installed
- WARNING latex: parser not installed
  - ADVICE:
    - Disable LaTeX support to avoid this warning by setting { latex = { enabled = false } }
- OK highlights enabled

markdown.nvim [executables] ~
- WARNING latex2text: not installed
  - ADVICE:
    - Disable LaTeX support to avoid this warning by setting { latex = { enabled = false } }

Additional information

No response

MeanderingProgrammer commented 3 months ago

Backticks are concealed by the nvim-treesitter here: https://github.com/nvim-treesitter/nvim-treesitter/blob/master/queries/markdown/highlights.scm#L50-L52

Do you override or extend highlights.scm in any way?

gennaro-tedesco commented 3 months ago

Do you override or extend highlights.scm in any way?

No, I do not.

However, I noticed that the highlight group @markup.raw.block does not exist (is not being created?). Shall I create it manually and then conceal it?

MeanderingProgrammer commented 3 months ago

No, that shouldn't make any real difference.

Your color scheme should make these groups, @markup.raw.block is an agreed upon naming convention: https://github.com/nvim-treesitter/nvim-treesitter/blob/master/CONTRIBUTING.md#highlights.

I looked at your treesitter config and found this line: https://github.com/gennaro-tedesco/dotfiles/blob/master/nvim/lua/plugins/treesitter.lua#L7

highlight = { enable = true, disable = { "markdown" } },

Concealing relies on treesitter highlights, they are disabled for markdown, hence concealing does not work for non inline elements like code blocks.

To fix this remove the disable setting:

highlight = { enable = true },

While I wrote a healthcheck to validate that highlights were enabled, I did not account for someone explicitly disabling it for markdown, that's a new one haha.

MeanderingProgrammer commented 3 months ago

Updated the healthcheck to account for this: https://github.com/MeanderingProgrammer/markdown.nvim/commit/8d1452860e1c6b03d814af10024c7edc88e44963.

Feel free to re-open if the fix from the previous comment does not work.

gennaro-tedesco commented 3 months ago

You are perfectly right, quite silly of me to not check my treesitter options first. Thank you a lot for taking the time to even dig into my config for it, much appreciated.

Now it all works fine!