🐞 Bug: backward slash inside inline code within a table cell causes misalignment
ibhagwan opened this issue · 28 comments
Before reporting:
- Ensure that the issue is reproducable on the main branch.
- Ensure that there isn't an issue on this(either open or closed).
Problem:
Images will work best, consider the below aligned table:
Due to the backward slash, will render as:
Fantastic plug-in btw @OXY2DEV, ty for your hard work! very meticulous :)
Steps to reproduce the issue:
Use inline code within a table cell with \
in it.
Expected behavior:
No response
Neovim version:
0.10.2
Can you check if the issue still occurs in the dev
branch?
Btw, forgot to mention my setup call removes the inline code “corner padding”:
require("markview").setup({
hybrid_modes = { "n" },
inline_codes = { corner_left = "", corner_right = "" },
})
Btw, I just found another issue in the dev
branch, regarding split toggle (which raises an exception on main branch).
- Run
:Markview splitToggle
- Make the source markdown win (not the rendered one) only window with
<C-w>o
- Run
:Markview splitToggle
again:
Can open another issue for this if you’d like, just wasn’t sure since this is the dev branch.
Btw, I just found another issue in the
dev
branch, regarding split toggle (which raises an exception on main branch).
- Run
:Markview splitToggle
- Make the source markdown win (not the rendered one) only window with
<C-w>o
- Run
:Markview splitToggle
again:
Can open another issue for this if you’d like, just wasn’t sure since this is the dev branch.
It should be fixed now.
Btw, forgot to mention my setup call removes the inline code “corner padding”:
require("markview").setup({ hybrid_modes = { "n" }, inline_codes = { corner_left = "", corner_right = "" }, })
I couldn't reproduce this.
Updated to the latest dev branch, here's the latest status:
-
:Markview splitToggle
- solved. - There's a duplicate tag in the vimdoc help file when updating the dev branch:
That happens when rendering fails.
What error message did you get?
No error messages and I get the same result on a different machine (with the same nvim config):
The odd thing is that my highlight links are cleared (the reason for the ugly red code blocks), even thought I have these right after setup.
The other odd thing is that if I leave the buffer and come back to it (even if I just open a simple fzf-lua float), the rendering is now fixed (but now requires set nowrap
to look good?):
If you are using a config and it goes away after removing the config.
You should also provide the config table.
My config is on Github, relevant part is in https://github.com/ibhagwan/nvim-lua/blob/main/lua/plugins/init.lua:
{
"OXY2DEV/markview.nvim",
enabled = true,
branch = "dev",
ft = "markdown",
config = function()
print("1")
require("markview").setup({
hybrid_modes = { "n" },
inline_codes = { corner_left = "", corner_right = "" },
})
vim.api.nvim_set_hl(0, "MarkviewCode", { default = false, link = "MarkviewHeading5" })
vim.api.nvim_set_hl(0, "MarkviewCodeInfo", { default = false, link = "MarkviewHeading5" })
vim.api.nvim_set_hl(0, "MarkviewInlineCode", { default = false, link = "MarkviewHeading5" })
vim.api.nvim_set_hl(0, "MarkviewIcon1", { default = false, link = "MarkviewHeading6" })
vim.api.nvim_set_hl(0, "MarkviewIcon2", { default = false, link = "MarkviewHeading6" })
vim.api.nvim_set_hl(0, "MarkviewIcon3", { default = false, link = "MarkviewHeading6" })
vim.api.nvim_set_hl(0, "MarkviewIcon4", { default = false, link = "MarkviewHeading6" })
vim.api.nvim_set_hl(0, "MarkviewIcon5", { default = false, link = "MarkviewHeading6" })
vim.api.nvim_set_hl(0, "MarkviewIcon6", { default = false, link = "MarkviewHeading6" })
print("2")
end
},
Both 1
and 2
are printed when I enter a markdown file so something is clearing my custom highlight links in the dev branch (which doesn't happen on main).
No error messages and I get the same result on a different machine (with the same nvim config):
Well, You definitely have something in your config that is changing the conceallevel
.
If the issue goes away after moving the cursor, changing modes & running
:Markview
, then it's something in your config.
The odd thing is that my highlight links are cleared (the reason for the ugly red code blocks), even thought I have these right after setup.
This can happen if you are loading you colorscheme after markview.
The wrap issue seems to also happen on the main branch, it seems that my window width is sufficient
It's an issue with Neovim. When wrapping lines Neovim doesn't consider hidden text. So, your width is 2x of what you see.
That's why it gets wrapped like that.
My config is on Github, relevant part is in
Well, You definitely have something in your config that is changing the conceallevel.
Did a search and removed all conceallevel
from my config, anywhere, issue still remains.
This can happen if you are loading you colorscheme after markview.
Not sure if that's the case, first this doesn't happen on main
and also I loaded the plugin only on ft = "markdown"
so it definitely loads after the colorscheme.
I tried changing it to lazy=false
and load the colorscheme after and the linked highlights get cleared which results in this:
Searching for the highlights
MarkviewCode
,MarkviewInlineCode
shows (all) were cleared
However, when I lazy load (meaning it's def after the colorscheme), something seems to reset my highlights to default:
It's an issue with Neovim. When wrapping lines Neovim doesn't consider hidden text. So, your width is 2x of what you see.
That's why it gets wrapped like that.
Understood
I can't reproduce the 1st bug with your config 🙁.
Ty for your hard work @OXY2DEV! sorry for this mess of an issue.
I'm not sure what is the "1st bug" anymore as I managed to complicate this issue beyond repair :-)
Let me try and make sense again, the OP/title issue is solved in dev
, the only 2 issues remaining are the "startup" issues:
- Highlight links that seem to get redefined on plugin load
- Bad rendering of tables on the first load only
However, when I lazy load (meaning it's def after the colorscheme), something seems to reset my highlights to default:
I think I figured out the issue.
Your colorscheme probably has a @markup.heading
, this gets picked up by MarkviewPalette5
, this gets linked by MarkviewHeading5
.
And you are linking to MarkviewHeading5
, so it's doing what it should.
Can you check what color @markup.heading
has?
Your colorscheme probably has a @markup.heading, this gets picked up by MarkviewPalette5, this gets linked by MarkviewHeading5.
And you are linking to
MarkviewHeading5
, so it's doing what it should.
Not sure I get this part, was something changed in this regard between main/dev?
MarkviewHeading5
Apparently, I accidentally deleted the autocmd responsible for setting the highlights 💀.
Let me fix that real quick.
That's the old documentation.
I am writing the new one at the moment.
The highlight groups issue should be fixed now.
The highlight groups issue should be fixed now.
The initial render issue seems to be fixed now, however, there's another issue with the unconcealing of tables, the first/last border lines remain visible (doesn't happen on main):
I have to relink to the new MarkviewPallete
groups now so the colors are ugly as hell
the first/last border lines remain visible
This is fixed now.
These happen with each move of the cursor.
I can't really fix it without seeing what is even causing the bug.
The best I can guess is there's something in the heading of the table that's causing the issue.
Do you have a link to the file causing the issue?
Do you have a link to the file causing the issue?
It's fzf-lua's README.
Btw, is there a single highlight I can change in my colorscheme that will derive better results for the generated MarkviewPallete background colors? I'm using bluz71/vim-nightfly-colors and the default generated theme has almost all highlights with high contrast red background, to fix it I have to pretty much relink all the highlights with background:
I found the issue.
Turns out the color space conversation function is buggy.
Let me fix that.
All the bugs should be fixed now