MeanderingProgrammer / markdown.nvim

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

Feature Request: Link concealing #10

Closed cubiquitous closed 3 months ago

cubiquitous commented 3 months ago

Allow conceiling for links. example:

on mkdnflow: image when hover: image

on markdown.nvim: image

MeanderingProgrammer commented 3 months ago

Hi, I like this idea, however there's one large limitation of this plugin that I'm unsure how to get around.

Currently we rely only on extmarks to overlay text or set highlight groups on top of the buffers content.

We don't actually modify the underlying buffer contents, which makes for easy switching back and worth between rendered and non-rendered.

With this in mind I am unsure how to handle the extra space after rendering a link. If we fill it with spaces (which is the only way I can think of), it ends up looking pretty ugly.

For example:

Check out [reference](https://website.com) for more information.

Would become:

Check out  reference                       for more information.

Ideally we would end up with something like:

Check out reference for more information.

But I'm not sure how to make that happen.

If anyone has any ideas / suggestions or wants to create a PR I'm more than happy to take a look at it!

With the main caveat being I don't want to overwrite the buffer itself.

MeanderingProgrammer commented 3 months ago

I've added support for this in the following commit: https://github.com/MeanderingProgrammer/markdown.nvim/commit/c2219984fa1ddc5d3f6a76c1c1ad0744aa9f9011

Turns out various markdown attributes are already concealable by default, users just need to set a high enough conceallevel.

Added support to this plugin to modify conceallevel based on whether the markdown is being rendered or not.

It does mostly what I would like it to do, and is easy enough to opt out of.

Please update the plugin and lmk if this is what you were looking for, thanks!