Skip to content

bug: diff code blocks not rendering properly in normal mode #110

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1 task done
jjohnston-aims opened this issue Jul 31, 2024 · 1 comment
Closed
1 task done

bug: diff code blocks not rendering properly in normal mode #110

jjohnston-aims opened this issue Jul 31, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@jjohnston-aims
Copy link

Neovim version (nvim -v)

NVIM v0.10.0

Operating system

Ubuntu 22.04

Terminal emulator / GUI

Default Terminal

Describe the bug

Diff code blocks are not being rendered properly in normal mode.
image

But they are in insert mode:
image

Expected behavior

I would expect to see in normal mode something like what I am seeing in edit mode for diff code blocks.

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

markdown.nvim [executables] ~

  • WARNING latex2text: not installed
    • ADVICE:
      • Disable LaTeX support to avoid this warning by setting { latex = { enabled = false } }

markdown.nvim [conflicts] ~

  • OK headlines: not installed
  • OK obsidian: not installed

Plugin configuration

Default configuration for LazyVim

{
  "MeanderingProgrammer/markdown.nvim",
  opts = {
    file_types = { "markdown", "norg", "rmd", "org" },
    code = {
      sign = false,
      width = "block",
      right_pad = 1,
    },
    heading = {
      sign = false,
      icons = {},
    },
  },
  ft = { "markdown", "norg", "rmd", "org" },
  config = function(_, opts)
    require("render-markdown").setup(opts)
    LazyVim.toggle.map("<leader>um", {
      name = "Render Markdown",
      get = function()
        return require("render-markdown.state").enabled
      end,
      set = function(enabled)
        local m = require("render-markdown")
        if enabled then
          m.enable()
        else
          m.disable()
        end
      end,
    })
  end,
}

Confirmations

  • I have provided markdown text for any screenshots used in my description & understand that my issue will be closed if I have not

Additional information

No response

@jjohnston-aims jjohnston-aims added the bug Something isn't working label Jul 31, 2024
@jjohnston-aims jjohnston-aims changed the title bug: bug: diff code blocks not rendering properly in normal mode Jul 31, 2024
MeanderingProgrammer added a commit that referenced this issue Aug 1, 2024
## Details

Requested: #110

Currently when we render code blocks we set a background highlight group.

This works for most languages, however some set backgrounds as well, an
example of this is git `diff`s. Since backgrounds cannot be easily combined
we instead allow disabling backgrounds for the languages configured under
`code -> disable_background`.

Other change is a refactor for context into a class with buffer level manager.
@MeanderingProgrammer
Copy link
Owner

Ah, I wasn't aware of any languages that set backgrounds, makes sense for git diffs.

The only thing we can really do is disable highlighting code blocks for relevant langauges.

Added support for this here: 9725df2

The default adds diff as a disabled language, if you update it should work.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants