MeanderingProgrammer / render-markdown.nvim

Plugin to improve viewing Markdown files in Neovim
MIT License
1.38k stars 33 forks source link

bug: The `Inline code` cannot be seen #103

Closed ziboh closed 1 month ago

ziboh commented 1 month ago

Neovim version (nvim -v)

0.10.1

Operating system

Windows

Terminal emulator / GUI

Wezterm

Describe the bug

When I'm renders a Inline code in Headings component,The Inline code cannot be seen.

image

Expected behavior

The Inline code displays correctly

Healthcheck output

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 } }

Plugin configuration

  {
    "MeanderingProgrammer/markdown.nvim",
    main = "render-markdown",
    opts = {},
    name = "render-markdown", -- Only needed if you have another plugin named markdown.nvim
    dependencies = { "nvim-treesitter/nvim-treesitter", "nvim-tree/nvim-web-devicons" }, -- if you use the mini.nvim suite
  },

Confirmations

Additional information

I think each Inline code in Headings component should be assigned to a separate highlight group.

MeanderingProgrammer commented 1 month ago

One thing is that based on your checkhealth I believe you're running an older version of the plugin. I don't think updating it will fix the problem, but can you still update to the latest version. Just so the next things I say are true, since highlight groups have been updated somewhat recently.

There is an option under code -> highlight_inline where you can define the highlight group used for inline code blocks. It's not specific to headings, but it does let you use a different value for inline code in general. I would recommend using one that works in both contexts, inside and outside of headings.

Unfortunately having separate logic to let you define a highlight specifically in the context of headings would be difficult, since the markdown_inline parser is separate from the block markdown parser and getting information between the 2 is difficult. Like when I'm processing an inline code block node I can't call the parent function on it until I get to a heading or some other block node type. The tree cuts off at the start of the inline node :(