MeanderingProgrammer / markdown.nvim

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

Cannot have more than one character as headings symbol #12

Closed Rukenshia closed 3 months ago

Rukenshia commented 3 months ago

Just found this cool plugin and wanted to customise it.

I wanted to replace the default heading symbols (because they're super tiny at least with my current font) with something else so I figured I would use h1., h2., and so on as the characters replacing the # in headings.

I used this config

return {
  'MeanderingProgrammer/markdown.nvim',
  dependencies = { 'nvim-treesitter/nvim-treesitter' },
  config = function()
    require('render-markdown').setup {
      headings = { 'h ', 'h2. ', 'h3. ', 'h4. ', 'h5. ', 'h6. ' },
    }
  end,
}

and have this markdown file

# heading

## subheading

I see this:

imagen

I'm not sure if it is intended like this (only allowing a single character), or if I'm doing stuff wrong, but the documentation for headings only says -- Characters that will replace the # at the start of headings which left it a bit unclear to me.

MeanderingProgrammer commented 3 months ago

Hi, thanks for brining this up. The way the logic was setup was to handle headings of length 1 or 2 only essentially.

I went ahead and patched this behavior in this commit: https://github.com/MeanderingProgrammer/markdown.nvim/commit/a0da7cfe61dd1a60d9ca6a57a72ae34edb64dbc9.

Please try it out with the following configuration and let me know what you think:

headings = { 'h ', 'h2 ', 'h3 ', 'h4 ', 'h5 ', 'h6 ' },

There is still a limitation on length for lower level headings. What I mean by that is since we don't shift text and just overlay it with an h1 like:

# Test

We only have 2 characters to play with, the # and the space before Test, anything longer will end up overwriting the title itself still.

Rukenshia commented 3 months ago

Thank you very much!