MeanderingProgrammer / render-markdown.nvim

Plugin to improve viewing Markdown files in Neovim
MIT License
1.73k stars 38 forks source link

✨feat(`dash.width`): New option added. #92

Closed Zeioth closed 3 months ago

Zeioth commented 3 months ago

Users can now do

dash = {
  icon = '─',
  width = 79
},

screenshot_2024-07-24_18-45-13_296783475

To limit the width of dash. This is cool for users using vim.opt.colorcolumn to improve readability.

MeanderingProgrammer commented 3 months ago

Thanks for the PR!

I merged in this change here: https://github.com/MeanderingProgrammer/markdown.nvim/commit/ff1b449bd02ab1a72a4ac9e621c033e335c47863

There were a few things I wanted to change from this implementation.

  1. Setting the default width to the width of the current buffer at the time the plugin loads. This fixes the width to a value and will not handle, for instance, resizing the terminal within a session. So the width value needs to be computed at the time the line is rendered.
  2. To fix 1 I ended up making the width type either the string full or an integer. I wasn't sure if I could do good enough type validation on this for the health check, but turned out not to be that bad.
  3. The BasicComponent type is shared between the dash and the quote components. This was just because they happened to be the same at the time, but now that dash has a width and that does not make sense for a quote I split this into 2 separate types.

In the process of figuring out 2 I wrote most of the code, so I ended up just merging that as a different commit.

I appreciate the idea and the implementation though!