-
Notifications
You must be signed in to change notification settings - Fork 61
help: Can't get the paragraph.min_width config option to work. #401
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The documentation on
The purpose of
So if you set a value of The way this is calculated is by taking the window width, subtracting the width of the longest line in the paragraph, and multiplying by 0.5. For example:
If you specified a
There's currently no way to specify the rows that should have a margin added within a paragraph, it's an all rows or none functionality, nor is there a way to apply the functionality to only some paragraphs and not others. I'm actually not sure which functionality you want. I wouldn't expect your example paragraph to work how you would like. Unless the paragraph is a single line and relies on If all you need is a way to disable the margin I can add a function to do that. Probably by allowing |
## Details Request: #401 Allows `paragraph.left_margin` option to be a function that returns a number based on the context in addition to a flat number. The context provided currently is just the text value of the node, but can be expanded in the future if needed. This can be used to set a different margin based on the length of the paragraph. For example use a margin of 4 for paragraphs longer than 80 characters, otherwise use no margin: ```lua require('render-markdown').setup({ paragraph = { left_margin = function(ctx) return #ctx.text > 80 and 4 or 0 end, }, }) ```
I've added the ability to set After updating if you want to use a require('render-markdown').setup({
paragraph = {
left_margin = function(ctx)
return #ctx.text > 80 and 4 or 0
end,
},
}) |
Yes sorry for taking some time to respond but your solution does solve my problem. I also wasn't clear in my initial question. My example was indeed one line and relies on |
Neovim version (nvim -v)
0.11.0
Neovim distribution
N/A
Description
I want paragraphs to be rendered in the french style, which means that they have a left margin on the first line only. Something that looks like that :
I was able to achieve it with the following config options :
This works fine but the indentation is annoying for small lines. It was my understanding that the this was purpose of the
min_width
options, i.e. disable paragraph-rendering (aka. adding indentation) if the paragraph is undermin_width
characters long. I've been testing it for about an hour and no matter what I do, changingmin_width
has no effect on rendering. I tried disabling potentially conflicting plugins like obsidian.nvim but it still doesn't do anything. Am I not understanding this config option properly?The text was updated successfully, but these errors were encountered: