MeanderingProgrammer / render-markdown.nvim

Plugin to improve viewing Markdown files in Neovim
MIT License
1.37k stars 32 forks source link

bug: Background of Indented code blocks in lists are not displayed correctly #133

Closed tigion closed 4 weeks ago

tigion commented 1 month ago

Neovim version (nvim -v)

0.10.1

Operating system

macOS

Terminal emulator / GUI

Kitty

Describe the bug

Indented code blocks in lists are not displayed correctly. This affects the background that starts at the beginning of the line.

Bildschirmfoto 2024-08-13 um 11 21 00
The example code: ~~~md A keymap suggestion: ```lua vim.keymap.set('n', 'cp', ':AsciiDocPreview', { desc = 'Preview AsciiDoc document' }) ``` - To use the same keymap for different file types and ... place the following in `after/ftplugin/asciidoc.lua`: ```lua local opts = { buffer = true, silent = true } opts.desc = 'Preview AsciiDoc document' vim.keymap.set('n', 'cp', ':AsciiDocPreview', opts) ``` This way the keymap is only set for AsciiDoc files. ~~~

Expected behavior

No background outside the indentation if possible.

Healthcheck output

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

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

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
- OK obsidian: not installed

Plugin configuration

  {
    'MeanderingProgrammer/render-markdown.nvim',
    dependencies = {
      'nvim-treesitter/nvim-treesitter',
      'echasnovski/mini.icons', -- if you use standalone mini plugins
      -- 'echasnovski/mini.nvim', -- if you use the mini.nvim suite
      -- 'nvim-tree/nvim-web-devicons', -- if you prefer nvim-web-devicons
    },
    -- ft = { 'markdown' },
    -- cmd = { 'RenderMarkdown' },
    keys = {
      {
        '<Leader>tm',
        '<Cmd>RenderMarkdown toggle<CR>',
        ft = 'markdown',
        desc = 'Toggle Render Markdown',
      },
    },
    opts = {
      enabled = false, -- Enable/disable by default (toggle with `<Leader>tm`)
      code = {
        sign = false,
        width = 'block',
        left_pad = 1,
        right_pad = 1,
      },
      heading = {
        sign = false, -- Don't show icons in sign column
        icons = {}, -- Don't replace `#` with icons in heading column
        -- Workaround to have background highlights without disabling the rendering of headings
      },
    },
  },

Confirmations

Additional information

No response

MeanderingProgrammer commented 1 month ago

Should be fixed by: https://github.com/MeanderingProgrammer/render-markdown.nvim/commit/4c823b1df151dbf1ed3ddaacac517be606b1e145

Give it a try and LMK!

b1nhack commented 1 month ago

When there are empty lines in the code block, the background is not consistent. Line 6.

pic

tigion commented 1 month ago

It works without blank lines, but not with.

MeanderingProgrammer commented 4 weeks ago

Should handle empty lines now: https://github.com/MeanderingProgrammer/render-markdown.nvim/commit/d1cec33f0d59bac5c2854312d2ea0483b44dfd11