MeanderingProgrammer / markdown.nvim

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

feature request: More options for checkmarks #42

Closed admbeck closed 2 weeks ago

admbeck commented 3 weeks ago

Is your feature request related to a problem? Please describe.

I have been testing the plugin with my lists and encountered a minor annoyance in my workflow. I often use symbols other than "X" in my checkmarks to indicate various statuses such as progress, cancellation, rescheduling, etc. image

Describe the solution you'd like

I was wondering if an option could be added to support a couple of other "custom" symbols for concealment.

checkbox = {
        unchecked = '󰄱 ',
        checked = '󰱒 ',
        -- custom checkbox
        custom1 = {
            original = "!" -- markdown: - [!]
            concealed = "󰀪"
        },
        custom2 = {
            original = "-" --markdown: - [-]
            concealed = "󰥔"
        },
        -- etc.
    },

Describe alternatives you've considered

I found similar functionality in Neorg, but their implementation is a bit wonky and only supports their own markup language. image

Alternatively, is it possible to conceal "-" if checkmark box (- [ ]) is not empty instead of turning it into a bullet (•)? image

Additional information

No response

MeanderingProgrammer commented 3 weeks ago

This reminds me of callouts, in that it hijacks some standard markdown syntax to do something else. It even hijacks the same thing, a link, which is kind of interesting.

Is this supported by any other markdown system, i.e. github flavored markdown?

What's happening here is that the non empty block, i.e. [!] is recognized as a link, not a checkbox, and links are concealed by default. So when you have something like - [!] it is seen as a list item followed by a link, so the dash from the list item gets replaced by a bullet and the square brackets are hidden as part of link concealing.

While I can see the issue given your particular workflow, I think this falls outside of anything this plugin should support. I'll see if there's some way I can enable you to support this functionality.

kuntau commented 2 weeks ago

I'm second this request, but I only need [-] though... For now it's too ugly with PaperColor theme

Is this supported by any other markdown system, i.e. github flavored markdown?

Not for [-] but it's pretty well-known convention for todo checkbox

MeanderingProgrammer commented 2 weeks ago

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

Had some minor naming changes in: https://github.com/MeanderingProgrammer/markdown.nvim/commit/7065c7d43598fd3c030d18df94a1b0ada60faa43

Please update and lmk how it works!

You can provide as many custom states as you like through checkbox -> custom.

I've added a default for the [-] state.

admbeck commented 2 weeks ago

Please update and lmk how it works!

Tried it out on nvim v0.10.0. Default behavior works. Custom state works. Highlights work. Perfect implementation of what I only hoped could be. Thanks a lot! image