-
Notifications
You must be signed in to change notification settings - Fork 49
feature: Flexible width code blocks + right-aligned language hint #73
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
Right padding and adaptable width code blocks have been implemented in this PR: #88! Use I'll come back to implementing the right aligned language at some point. If I don't like any implementation I come up with will provide an update. |
I just updated this plugin today, but the Rendered code blockPlugin configreturn {
"MeanderingProgrammer/markdown.nvim",
as = "render-markdown",
main = "render-markdown",
dependencies = {
"nvim-treesitter/nvim-treesitter",
},
ft = {
"markdown",
},
opts = {
code = {
style = "normal", -- {"none", "normal", "language", "full"} code blocks don't show language info in heading
width = "block", -- {"block, "full"} only highlight relevant region instead of entire width
right_pad = 2,
},
},
}
|
Oh that is strange, I am definitely not seeing the same behavior with the same config. Can you send me the markdown file text from the screenshot, just so I can rule that out. Otherwise I'll need some kind of minimal reproducible example which you would get by gradually disabling plugins and options. If the problem persists for instance, with only a plugin manager, nvim-treesitter, and my plugin that makes things a lot easier to reason about. Also how does it look if you create a file with the following contents only:
|
Good idea that it's another plugin interfering, it was my color scheme having "transparent background" set! https://github.com/catppuccin/nvim?tab=readme-ov-file#configuration With this setting disabled the code block renders as expected which is fine with me. Thanks! |
Interesting if you can find a way for me to create a transparent background with virtual text feel free to create a feature request for it. Currently we hard code the highlight for the fixed width padding to It makes sense that a transparent background doesn't quite work with this. But if there is a transparent highlight group that exists I can make that highlight configurable. |
## Details Request: #73 Adds new field `code -> position` with valid values `left` & `right`. Default value of `left` results in no change to current behavior. Changing the value to right will move the language icon to align roughly with the right side of the longest line in the code block. There is slightly different positioning for `block` vs `full` widths.
Support for right aligned language hint added here: 4d8b603 Enable it with: require('render-markdown').setup({
code = { position = 'right' },
}) I believe this completes all the requested features, feel free to re-open if it does not work as intended. Thanks for the suggestions! |
With above's snippet (#73 (comment)), I expected the language hint to be rendered aligned to the right of the window, but it depends on the length of the longest line in the code. Is that the intended behaviour? I just started playing around with this plugin, such that this comment can be considered more of an FYI than a request. |
@benj9000, it is the intended behavior, since on particularly wide windows having it all the way to the right isn't a great experience, at least that would be my opinion. I could add something where it would be all the way to the right up to some max width, or just all the way to the right. So if either of those seem interesting to you feel free to create a feature request :) |
Is your feature request related to a problem? Please describe.
Not a problem, just a suggestion :)
Describe the solution you'd like
I am using this plugin over
markview.nvim
because of many key reasons, including the lower amount of errors (e.g., with rendering nested bullet lists) and the ease of setting it up for non-markdown filetypes. However, I still really like the way code blocks are rendered inmarkview.nvim
. Could some of those features be implemented here? Particularly:markview.nvim
when wrapping lines that are too long, it seems to break the non-full-width code block render.Describe alternatives you've considered
No alternatives, the plugin is still great as-is ATM.
Additional information
No response
The text was updated successfully, but these errors were encountered: