MeanderingProgrammer / markdown.nvim

Plugin to improve viewing Markdown files in Neovim
MIT License
504 stars 20 forks source link

Feature Request #30

Closed Parilia closed 1 month ago

Parilia commented 1 month ago

I would love support for vimwiki https://github.com/vimwiki/vimwiki/

MeanderingProgrammer commented 1 month ago

Hi there,

I understand why there would be a want for this, especially since the syntax is very close to markdown.

However it is also different enough where I would need to write a completely custom set of queries and handlers, essentially non of the markdown logic would really transfer over.

They would start to diverge over time, support different features, really its just not something I want to maintain since I don't look at vim wiki files often.

At this point, at least for now, I've decided to put a line in the scope of this project.

I have however added a feature that allows users to write and add their own custom handlers: https://github.com/MeanderingProgrammer/markdown.nvim/commit/473e48dd0913d2e83610c86c5143a07fd7e60d4e.

You specify the language and write a render function. The render function will get information like the namespace, buffer, and tree. The plugin core takes care of clearing any marks added to the namespace and re-rendering when necessary, like between mode changes.

Hopefully this strikes a balance between what I like about this plugin and what users want out of it. If people like this feature and add cool things they want to share with the community I can add a doc full of user handlers.

LMK what you think, and thanks for the interest!

MeanderingProgrammer commented 1 month ago

Closing for now, lmk if there's anything you'd like to follow up on!

Parilia commented 1 month ago

vimwiki isnt only .wiki files. It also can support markdown files. I will look into the custom handlers

MeanderingProgrammer commented 1 month ago

This plugin supports specifying the filetypes it runs on in the configuration. For example:

require('render-markdown').setup({
    file_types = { <whatever_ft_vimwiki_is>, 'markdown' },
})

If you're editing a markdown file as a vimwiki file, depending on what's going on under the hood of the vimwiki plugin, this plugin should just work.

So long as the filetype is included in the list and treesitter is parsing the buffer as markdown everything should work.