Skip to content

It doesn't work with vimplug (sadly) #39

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
MarcusXavierr opened this issue Jun 12, 2024 · 13 comments
Closed

It doesn't work with vimplug (sadly) #39

MarcusXavierr opened this issue Jun 12, 2024 · 13 comments
Labels
bug Something isn't working

Comments

@MarcusXavierr
Copy link

MarcusXavierr commented Jun 12, 2024

I've installed the plugin with vimplug and made the setup

image

The setup seems to be successful, because the command is avaliable on neovim

image

But when I run this, nothing happens

P.s.:

I have markdown parser installed on treesitter
image

@MeanderingProgrammer
Copy link
Owner

Huh, that is interesting. I don't have any familiarity with vim plug, but hopefully we can get it working.

Can you run the checkhealth command 'checkhealth render-markdown', see if that has any information.

Also which version of Neovim are you running and on what OS?

@MarcusXavierr
Copy link
Author

MarcusXavierr commented Jun 12, 2024

@MeanderingProgrammer This erros occurs
image

I'm using fedora 39 and neovim 0.9.5
image

@MeanderingProgrammer
Copy link
Owner

Ah, damn, I thought I still had compatibility with 0.9.5, but looks like list_contains was added in 0.10.0.

I pushed a small change that should resolve the health check failing. Can you update the plugin and run it again, just as a sanity check.

Maybe the reason this isn't working is I'm using some other API that's not compatible with 0.9.5. I haven't found a good way to determine which APIs existed for which versions of Neovim. However in that case the error should be printed out and pretty obvious, which doesn't seem to be happening right?

@MarcusXavierr
Copy link
Author

I've updated, and the checkhealt seems ok, but it's still not working

image

I've also downloaded the neovim 0.10.0 binary and used it, but still not worked

image

image

@MeanderingProgrammer
Copy link
Owner

Oh, sorry about that, didn't mean for you to need to update the version of neovim you use, but appreciate the thoroughness!

Lets see if the logs can help.

Can you enable debug logs by updating the plugin config to:

require('render-markdown').setup({ log_level = 'debug' })

Then create a new markdown file with the following content, just so I can compare my output to yours:

# Heading

- Item
  - Nested

> [!NOTE]
> A note

- [ ] Unchecked
- [x] Checked

Open the file, the plugin will try to render it, then close the file.

Then copy the output of the log file which will most likely be located at ~/.local/state/nvim/render-markdown.log, and paste the results here.

@MarcusXavierr
Copy link
Author

I've set the log_level to debug, then opened the file with this content. But it didn't seem to create a log file
image

@MarcusXavierr
Copy link
Author

I put a print on the toggle function, and it seems to be called

image

image

@MarcusXavierr
Copy link
Author

MarcusXavierr commented Jun 13, 2024

It early returns at this clear_valid function

image

@MarcusXavierr
Copy link
Author

MarcusXavierr commented Jun 13, 2024

Mistery solved! As I use vimwiki, my markdown files are for some reason being recognized as vimwiki files.

image

image

If I add the vimwiki option at filetypes, it crashes :(
image

image

if I remove vimwiki it works
image

@MarcusXavierr
Copy link
Author

Set the filetype to markdown with autocmd seems the best workaround. I continue with vimwiki working and the markdown plugin works too. The only issue is that the autocmd does not works every time

@MeanderingProgrammer
Copy link
Owner

MeanderingProgrammer commented Jun 13, 2024

Ah that makes sense, parsers are picked using the vim.treesitter apis and vimwiki both sets the filetype and doesn't have an associated parser, so we run into this error.

Instead of the autocommands a more robust options would be to do the following two things (at least I think this would work lmk if it does!):

  1. Add vimwiki to the file_types this plugin runs on:
require('render-markdown').setup({
  file_types = { 'markdown', 'vimwiki' },
})
  1. Register markdown as the parser for vimwiki files:
vim.treesitter.language.register('markdown', 'vimwiki')

@MarcusXavierr
Copy link
Author

It worked pretty well. Thanks

Maybe it's good to put a Notice to vimwiki users on readme

@MeanderingProgrammer
Copy link
Owner

@MeanderingProgrammer MeanderingProgrammer added the bug Something isn't working label Feb 7, 2025
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