Skip to content

bug: Table render issues of indentation and alignment #142

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

Closed
1 task done
xlucn opened this issue Aug 22, 2024 · 2 comments
Closed
1 task done

bug: Table render issues of indentation and alignment #142

xlucn opened this issue Aug 22, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@xlucn
Copy link

xlucn commented Aug 22, 2024

Neovim version (nvim -v)

0.10.1

Operating system

Arch Linux

Terminal emulator / GUI

foot

Describe the bug

  1. Cell content is rendered with the last letter right-aligned, while the rest is left aligned. This happens when the content is directly enclosed by || with no spaces between the end of the content and |
|aaaaaa|bb|cccccc|
|-|-|-|
|yes|nooooooooo|no |

20240822_13h33m30s_grim

  1. If the table is indented (less than 4 spaces, otherwise it's treated as code), the rendered borders are not indented
  |aa|bb|cc|
  |-|-|-|
  |1|2|3|

20240822_13h35m41s_grim

Expected behavior

  1. The whole cell content is left aligned.
  2. The whole table will indent as the code does.

Healthcheck output

render-markdown: require("render-markdown.health").check()

render-markdown.nvim [version] ~
- OK plugin 6.1.3
- OK neovim >= 0.10

render-markdown.nvim [configuration] ~
- OK valid

render-markdown.nvim [nvim-treesitter] ~
- OK installed
- OK markdown: parser installed
- OK markdown: highlight enabled
- OK markdown_inline: parser installed
- OK markdown_inline: highlight enabled

render-markdown.nvim [executables] ~
- OK none to check

render-markdown.nvim [conflicts] ~
- OK headlines: not installed
- WARNING obsidian: installed
  - ADVICE:
    - Ensure UI is disabled by setting ui = { enable = false } in obsidian.nvim config
    - Acknowledge conflicts to avoid this warning by setting { acknowledge_conflicts = true }

Plugin configuration

lazy.nvim config:

    {
        "MeanderingProgrammer/render-markdown.nvim",
        ft = "markdown",
        dependencies = {
            'nvim-treesitter/nvim-treesitter',
            'nvim-tree/nvim-web-devicons'
        },
    },

Plugin error log

  • (file empty)

Confirmations

  • I have provided markdown text for any screenshots used in my description & understand that my issue will be closed if I have not

Additional information

I have just checkout the latest commit 0a8b941 for the tests above.

@xlucn xlucn added the bug Something isn't working label Aug 22, 2024
MeanderingProgrammer added a commit that referenced this issue Aug 22, 2024
## Details

Issue: #142

This resolves 2 separate issues.

The first is for tables that are indented some amount space over. In
such cases the top & bottom full sections as well as the delimitter
would be misaligned since they did not take into account any leading
spaces and generate full lines rather than changing individual parts
which is the case for rows. To fix this add logic to get the amount of
leading space and shift these components over accordingly.

The second is for tables where the contents of a cell went all the way
to the right pipe with no spaces. This would cause the padding to be
inserted in the middle of the content rather than at the end. To fix
this adjust the column associated with padding to no longer subtract one
off. Use a priority value of 0 for the padding marks so the pipe marks
pickup the padding as well, otherwise they would end up ignoring it.
@MeanderingProgrammer
Copy link
Owner

Should be fixed by: a3617d6

@xlucn
Copy link
Author

xlucn commented Aug 22, 2024

Wow, that is fast response. Those issues are fixed. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants