MeanderingProgrammer/render-markdown.nvim

no parser for 'markdown' language

Closed this issue · 6 comments

Hello,
i always get the error:

packer.nvim: Error running config for markdown.nvim: ...local
/share/nvim/runtime/lua/vim/treesitter/language.lua:93: no pa
rser for 'markdown' language, see :help treesitter-parsers

but i have the markdown/markdown_inline treesitter parsers:

nvim-treesitter: require("nvim-treesitter.health").check()

Installation ~
- OK `tree-sitter` found 0.20.8 (parser generator, only needed for :TSInstallFromGrammar)
- OK `node` found v18.19.0 (only needed for :TSInstallFromGrammar)
- OK `git` executable found.
- OK `cc` executable found. Selected from { vim.NIL, "cc", "gcc", "clang", "cl", "zig" }
  Version: cc (Debian 12.2.0-14) 12.2.0
- OK Neovim was compiled with tree-sitter runtime ABI version 14 (required >=13). Parsers must be compatible with runtime ABI.

OS Info:
{
  machine = "x86_64",
  release = "6.1.0-20-amd64",
  sysname = "Linux",
  version = "#1 SMP PREEMPT_DYNAMIC Debian 6.1.85-1 (2024-04-11)"
} ~

Parser/Features         H L F I J
  - bash                ✓ ✓ ✓ . ✓
  - c                   ✓ ✓ ✓ ✓ ✓
  - css                 ✓ . ✓ ✓ ✓
  - dart                ✓ ✓ ✓ ✓ ✓
  - gitignore           ✓ . . . .
  - go                  ✓ ✓ ✓ ✓ ✓
  - html                ✓ ✓ ✓ ✓ ✓
  - javascript          ✓ ✓ ✓ ✓ ✓
  - json                ✓ ✓ ✓ ✓ .
  - latex               ✓ . ✓ . ✓
  - lua                 ✓ ✓ ✓ ✓ ✓
  - markdown            ✓ . ✓ ✓ ✓
  - markdown_inline     ✓ . . . ✓
  - python              ✓ ✓ ✓ ✓ ✓
  - query               ✓ ✓ ✓ ✓ ✓
  - tsx                 ✓ ✓ ✓ ✓ ✓
  - typescript          ✓ ✓ ✓ ✓ ✓
  - vim                 ✓ ✓ ✓ . ✓
  - vimdoc              ✓ . . . ✓
  - yaml                ✓ ✓ ✓ ✓ ✓

I'm confused, do i need another parser?

thanks

Can you paste your configuration

Also run the following and let me know what it prints out: :checkhealth render-markdown


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

Checking required treesitter parsers ~
- OK markdown parser installed
- OK markdown_inline parser installed

and the configuration:

    use { 'MeanderingProgrammer/markdown.nvim', config = function()
        require('render-markdown').setup({

            headings = { 'Ⅰ ', 'Ⅱ ', 'Ⅲ ', 'Ⅳ ', 'Ⅴ ', 'Ⅵ ' },
            dash = '—',
            -- Character to use for the bullet points in lists
            bullets = { '●', '○', '◆', '◇' },
            -- ☐☑☒
            checkbox = {
                -- Character that will replace the [ ] in unchecked checkboxes
                unchecked = '☐ ',
                -- Character that will replace the [x] in checked checkboxes
                checked = '☒ ',
            },
            -- Character that will replace the > at the start of block quotes
            quote = '┃',
        })
    end}

I'm not familiar with packer, but if I had to guess this is caused by missing the nvim-treesitter dependency, like the config in the README has.

In the setup method this plugin does some query parsing to avoid doing this on every render call. If the plugin manager just so happens to call this plugin before tree-sitter it'll cause an error.

Try adding the dependency to your config. Below is what I think it would look like from reading the packer examples: https://github.com/wbthomason/packer.nvim, but I'm not entirely sure.

use({
    'MeanderingProgrammer/markdown.nvim',
    as = 'render-markdown', -- Only needed if you have another plugin named markdown.nvim
    requires = { 'nvim-treesitter/nvim-treesitter' },
    config = function()
        ....
    end,
})

okey, i see. the requires parameter specifies just the plugin requirement. but for this plugin to work, it is necessary to have nvim-treesitter loader before this plugin. in my case, would be:

    use ({ 'MeanderingProgrammer/markdown.nvim',
        after = { 'nvim-treesitter' },
        as = 'render-markdown',
        config = function()
...

Thanks for the support!

Glad you got it figured out, I'll add this packer config to the README as well.

I'm a little confused on the difference between requires and after. To me they both sound like they would load whatever plugins appear in the list before the plugin. Looking at the README there does seem to be some distinction between dependencies and sequencing, which is confusing me as a dependency implies sequencing, at least in my head.

Any info you have on the difference would be much appreciated!

As i understand, requires only ensure that the plugin is installed. while after ensures that plugin A is loaded after plugin B. I'm not sure if requires also load the plugin whenever one plugin is loaded, but in any case, it is necessary to load one plugin after the other