MeanderingProgrammer / render-markdown.nvim

Plugin to improve viewing Markdown files in Neovim
MIT License
1.48k stars 36 forks source link

feature: Support pipe literal in table #189

Open JordanllHarper opened 1 day ago

JordanllHarper commented 1 day ago

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

Currently, using pipe literal syntax results in seeing the escape character as well as the | itself.

Minimal example:

Item1 Item2
| PIPE

produces

image

Describe the solution you'd like

I would like to see this only when the cursor is hovering over the table entry, and otherwise just show the pipe operator.

Describe alternatives you've considered

None, open to alternatives!

Additional information

No response

JordanllHarper commented 1 day ago

Just adding a note here. The example on github does not show literal markdown syntax, but illustrates my point that the escape character should not be shown unless the cursor is hovering over it.

MeanderingProgrammer commented 1 day ago

I rely on treesitter highlights as the source of truth for what is concealed and treesitter itself to do the concealing.

For the time being I do not want to manipulate this directly in the plugin.

However you can hide more things by extending the highlights in your config.

To do this add a file in your config at: after/queries/markdown_inline/highlights.scm

Then put the following contents:

;extends

(
    (backslash_escape) @conceal
    (#set! conceal "")
    (#offset! @conceal 0 0 0 -1)
)

I did find a bug where I wasn't handling offsets in the plugin so you'll also need to update the plugin to pickup this commit: https://github.com/MeanderingProgrammer/render-markdown.nvim/commit/0cab868ce2b017ff9deccee87c289dc1915317be, to fix some issues with alignment.