MeanderingProgrammer / render-markdown.nvim

Plugin to improve viewing Markdown files in Neovim
MIT License
1.38k stars 33 forks source link

feature: Support Callouts of different casign #74

Closed AquilesGomez closed 1 month ago

AquilesGomez commented 2 months ago

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

When i create Callouts, I don't always capitalize the marks. For example, I sometimes do [!todo] instead of [!TODO].

Describe the solution you'd like

If I match the word (regardless of casing), it should detect it as a callout block. that is both [!todo] and [!TODO] and [!Todo] should all be callout blocks.

I think we can edit this snippet: https://github.com/MeanderingProgrammer/markdown.nvim/blob/6aa19e9bf36938049e36cd97aafedfe938de8d79/lua/render-markdown/component.lua#L13-L22

local function matches(callout)
        if comparison == 'exact' then
            return text == callout.raw
        elseif comparison == 'contains' then
            return text:find(callout.raw, 1, true) ~= nil
        else
            error(string.format('Unhandled comparison: %s', comparison))
        end
    end

to match against a string.lower

Describe alternatives you've considered

I've manually modified the callout section for now, but this is cumbersome and redeclares a lot of the same values.

Additional information

No response

MeanderingProgrammer commented 2 months ago

Makes sense, updated here: https://github.com/MeanderingProgrammer/markdown.nvim/commit/123048b428eb85618780fcef9ea9f4d68b5d2508