### 🔖 Feature description:
I'd like to set `min_width` for code blocks and similar elements to the `'textwidth'` of the buffer. would make it easier to tell visually what the textwidth of the buffer is without having other indicators like 'colorcolumn' or whatnot
in my head the most straightforward configuration would look like:
```lua
require('markview').setup({
markdown = {
code_blocks = {
min_width = function() return vim.bo.textwidth end -- or "textwidth" would be a reasonable hardcoded string preset, i think
},
},
})
```
### 📂 Possible solutions:
mostly just replacing every resolution of min_width with:
```lua
local min_width = config.min_width
local block_width = type(min_width) == "function" and min_width() or min_width or 60
```
then updating types/docs accordingly
### 🧾 Feature reference:
_No response_
@pynappo This is already supported,
```lua
markdown = {
code_blocks = {
min_width = function(buf)
local textwidth = vim.bo[buf].textwidth;
if textwidth == 0 then
-- Some default value
return 60;
else
return textwidth;
end
end
}
}
```
Every configuration option inside the plugin can be a function. So, this can be used for most other option too.
Initially it was, but it just made people have issues reading the docs. And I didn't really see anyone using this feature.
So, it was removed. It also made reading types from LSP kinda hard, so it was removed from the type files.
The [`require("markview.spec").get()`](https://github.com/OXY2DEV/markview.nvim/blob/2471f4097f8561a6880a0fe05ee0f21cbc82b374/lua/markview/spec.lua#L267) function is used to get config values which supports functions(even in nested tables).
So, every option(unless explicitly mentioned in the wiki) in the plugin has a `<type> | fun(buffer: integer, item: table): <type>` type.