Skip to content

feature: disable syntax conseal #467

Open
@oleg-work

Description

@oleg-work

Is your feature request related to a problem? Please describe.

First of all thanks for your work, finally I found a plugin to be able to easily
read text inside neovim.

When you are going in/out of insert mode than back again a lot screen is
constantly moved up/down, left/right to adjust for new lines/characters which
were previously concealed. Examples bottom border of code block, inline code,
inline bold text. This is distracting and I wonder if concealed text can be
turned off (see :help vim.g.markdown_syntax_conceal = 0) while changed
text preserved (for example changing - to character) and added text
preserved (for example code = { left_margin = 3 }).

Describe the solution you'd like

Config:

{
    "MeanderingProgrammer/render-markdown.nvim",
    opts = {
      render_modes = { "n", "c", "t" },
      anti_conceal = {
        enabled = true,
        above = 1000,
        below = 1000,
        ignore = {
          -- otherwise screen is moved line up/down
          -- when going in/out of insert mode
          head_icon = true,
          head_background = true,
          head_border = true,
          code_language = false,
          code_background = true,
          code_border = false,
          dash = true,
          bullet = true,
          check_icon = true,
          check_scope = true,
          quote = true,
          table_border = true,
          callout = true,
          link = true,
          sign = false,
        },
      },
      code = {
        sign = false,
        width = "block",
        right_pad = 1,
        left_margin = 3,
      },
      heading = {
        sign = true,
        signs = { "ℍ₁", "ℍ₂", "ℍ₃", "ℍ₄", "ℍ₅", "ℍ₆" },
        icons = {},
      },
      checkbox = {
        enabled = false,
      },
    },
    ft = { "markdown", "norg", "rmd", "org", "codecompanion" },
    config = function(_, opts)
      vim.g.markdown_syntax_conceal = 0
      require("render-markdown").setup(opts)
      Snacks.toggle({
        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,
      }):map("<leader>um")
    end,
  }

Desired result:
Image

It would be great to have precise control of what is concealed in which
mode, what is added in which mode, what is changed in which mode for the
whole text and additional config for lines around cursor.

Describe alternatives you've considered

I tried to play with anti_conceal config option to no avail.

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions