MeanderingProgrammer / render-markdown.nvim

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

bug: Wikilinks alias not working as expected #132

Closed norbeyandresg closed 1 month ago

norbeyandresg commented 1 month ago

Neovim version (nvim -v)

0.9.5

Operating system

MacOs

Terminal emulator / GUI

Alacritty

Describe the bug

Wikilinks are not rendering properly when add alias to it

image image image

Expected behavior

image image image

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

render-markdown.nvim

return {
    "MeanderingProgrammer/render-markdown.nvim",
    opts = {},
    dependencies = {
        "nvim-treesitter/nvim-treesitter",
        "echasnovski/mini.nvim",
    },
    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 = {
                position = "right",
                -- 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 = 3,
                -- 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,
}

treesitter.vim

return {
    "nvim-treesitter/nvim-treesitter",
    build = ":TSUpdate",
    config = function()
        require("nvim-treesitter.configs").setup({
            -- A list of parser names, or "all"
            autotag = {
                enable = true,
            },
            ensure_installed = {

                "c",
                "diff",
                "html",
                "javascript",
                "jsdoc",
                "json",
                "jsonc",
                "lua",
                "luadoc",
                "luap",
                "markdown",
                "markdown_inline",
                "python",
                "query",
                "regex",
                "toml",
                "tsx",
                "typescript",
                "vim",
                "vimdoc",
                "xml",
                "yaml",
            },

            -- Install parsers synchronously (only applied to `ensure_installed`)
            sync_install = false,

            -- Automatically install missing parsers when entering buffer
            -- Recommendation: set to false if you don"t have `tree-sitter` CLI installed locally
            auto_install = true,

            indent = {
                enable = true,
            },

            highlight = {
                -- `false` will disable the whole extension
                enable = true,

                -- Setting this to true will run `:h syntax` and tree-sitter at the same time.
                -- Set this to `true` if you depend on "syntax" being enabled (like for indentation).
                -- Using this option may slow down your editor, and you may see some duplicate highlights.
                -- Instead of true it can also be a list of languages
                additional_vim_regex_highlighting = { "markdown" },
            },
        })
    end,
}

Confirmations

Additional information

No response

MeanderingProgrammer commented 1 month ago

This is another limitation of using neovim < 0.10.0, since this feature conceals and inlays content.

I'm curious what would be a better way to handle this?

None of these sound ideal but I also don't want to triage bugs like this. I'm very open to suggestions I just don't have a good way to handle it at the moment. The best I've been able to do is say some features will not work for older versions in the health check but keeping the list of exactly what doesn't work up to date and understandable is not feasible.

MeanderingProgrammer commented 1 month ago

Logging an error and submitting logs sounds reasonable and easy 🙂

norbeyandresg commented 1 month ago

Logging sounds good. Does this type of limitations generate an error in other versions of vim rather than 0.10? Or what you're going to put into that logs?

Could be confusing if is just a regular error that doesn't point to the vim version

MeanderingProgrammer commented 1 month ago

Not using vim.notify, this plugin has a logger that appends to a file. I've updated the issue template to ask for this file's contents and updated the logic to add an error log when inline marks are skipped due to version.

More details in: https://github.com/MeanderingProgrammer/render-markdown.nvim/commit/7986be47531d652e950776536987e01dd5b55b94