-
Notifications
You must be signed in to change notification settings - Fork 51
Maintain custom highlights inside tables #21
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
Make sense. Since we overlay the entire row with the Normal mode highlight it ends up overwriting any syntax in the cells. |
While this is possible to do I'm finding that handling concealing is a problem. Meaning when we have a link or inline code block in a row, it will get concealed as part of rendering which will misalign the table: like so: Currently this is not a problem since the virtual text that gets overlayed includes all of the raw content without any concealing like so: Between these 2 options I definitely prefer the latter. My thought now is to add the ability to disable rendering of tables entirely if users prefer looking at the highlighted version. Lmk if you have any thoughts / suggestions. |
Is highlight linked to concealing in this case? I'm okay without any conceal, but the links can still be highlighted like in insert mode. So, the same number of rendered cells, but with proper colors. If it's linked and cannot be dettached, I will be also okay with disabling formatting for tables. |
Concealing is a general behavior of this plugin, added here: #10. The conceal level gets changed between the rendered view and raw view. As far as I'm aware there is no way to scope options like that to a specific range in a window, so they need to apply to the entire window. Since a table cell can contain any markdown, including links, is just another thing to consider. I'll add a way of disabling table rendering. |
# Details * fat_tables option removed * table_style option added * If fat_tables option was not being set default behavior remains the same * If fat_tables option was set to false setting table_style option to 'normal' will result in the same behavior * Setting table_style to 'none' is new behavior and will stop rendering markdown tables: #21
I see. I see this already happens with normal treesitter with concealling enabled. I suppose the only solution would be to modify the nvim-treesitter highlights (here), but that'd be a ton of work. |
Added the new behavior here: 49f4597 You can now configure the plugin with: { table_style = 'none' } In terms of modifying treesitter directly, apart from the effort, that would end up changing the behavior for everyone, and it does end up just being a preference as opposed to correct / incorrect behavior. Hopefully this offers a decent middle ground though. |
Amazing! Thank you very much, closing the issue now. |
It seems that custom highlights are lost when matched inside a table cell.
Example document:
Add the syntax and highlights:
Output when editing is showing the styles as expected:
But normal mode rendering is removing the highlight inside the table:
The text was updated successfully, but these errors were encountered: