MeanderingProgrammer / render-markdown.nvim

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

bug: CodeBlock not rendering title #125

Closed norbeyandresg closed 3 months ago

norbeyandresg commented 3 months ago

Neovim version (nvim -v)

0.9.5

Operating system

MacOs

Terminal emulator / GUI

Alacrity

Describe the bug

Code block shows icon in the sign column but not in the code block header

image image

Expected behavior

icon and language shows as a code block title

Healthcheck output


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

render-markdown.nvim [version] ~
- OK plugin 6.0.8
- WARNING neovim < 0.10 some features will not work

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

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

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

render-markdown.nvim [conflicts] ~
- OK headlines: not installed
- WARNING obsidian: installed
  - ADVICE:
    - Ensure UI is disabled by setting ui = { enable = false } in obsidian.nvim config
    - Acknowledge conflicts to avoid this warning by setting { acknowledge_conflicts = true }

Plugin configuration

my lazy config

return {
    "MeanderingProgrammer/render-markdown.nvim",
    opts = {},
    dependencies = {
        "nvim-treesitter/nvim-treesitter",
        "echasnovski/mini.nvim",
        "echasnovski/mini.icons",
    },
    config = function()
        require("render-markdown").setup({
            max_file_size = 5.5,
            heading = {
                border = true,
                -- Replaces '#+' of 'atx_h._marker'
                -- The number of '#' in the heading determines the 'level'
                -- The 'level' is used to index into the array using a cycle
                -- icons = { "", "", "", "", "", "" },
                icons = { "󰲡 ", "󰲣 ", "󰲥 ", "󰲧 ", "󰲩 ", "󰲫 " },

                -- The 'level' is used to index into the array using a clamp
                -- Highlight for the heading icon and extends through the entire line
                -- backgrounds = {
                --  "",
                --  "",
                --  "",
                --  "",
                --  "",
                --  "",
                -- },
                backgrounds = {
                    "RenderMarkdownH1Bg",
                    "RenderMarkdownH2Bg",
                    "RenderMarkdownH3Bg",
                    "RenderMarkdownH4Bg",
                    "RenderMarkdownH5Bg",
                    "RenderMarkdownH6Bg",
                },
            },
            code = {
                -- Amount of padding to add to the left of code blocks
                left_pad = 4,
                -- Amount of padding to add to the right of code blocks when width is 'block'
                right_pad = 10,
                -- Width of the code block background:
                --  block: width of the code block
                --  full: full width of the window
                width = "block",
                -- Determins how the top / bottom of code block are rendered:
                --  thick: use the same highlight as the code body
                --  thin: when lines are empty overlay the above & below icons
                border = "thick",
                highlight = "RenderMarkdownH2Bg",
                highlight_inline = "RenderMarkdownH1Bg",
            },
            bullet = {
                -- Replaces '-'|'+'|'*' of 'list_item'
                -- How deeply nested the list is determines the 'level'
                -- The 'level' is used to index into the array using a cycle
                -- If the item is a 'checkbox' a conceal is used to hide the bullet instead
                icons = { "● ", "○ ", "◆ ", "◇ " },
            },
        })
    end,
}

Confirmations

Additional information

No response

MeanderingProgrammer commented 3 months ago

This is part of the some features will not work if you're using neovim < 0.10.0.

The implementation for the left aligned language hint relies on inline extmarks which would cause an error for you.

What is kind of interesting is that the right aligned language hint does not use inline extmarks since it does not have to worry about shifting text.

So if you add the following to your config:

require("render-markdown").setup({
    code = {
        position = 'right',
    },
})

You'll get the language hint, though maybe not where you would prefer.

MeanderingProgrammer commented 3 months ago

Btw I wouldn't add both echasnovski/mini.nvim & echasnovski/mini.icons as dependencies, since it's just not necessary.

Either one on its own is sufficient.