Skip to content

bug: latex2text not indented when indent enabled #421

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
2 tasks done
drzhivago420 opened this issue May 8, 2025 · 1 comment
Closed
2 tasks done

bug: latex2text not indented when indent enabled #421

drzhivago420 opened this issue May 8, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@drzhivago420
Copy link

Neovim version (nvim -v)

0.12.0

Neovim distribution

N/A

Operating system

Kubuntu 24.04.2

Terminal emulator / GUI

kitty

Describe the bug

Image

As you can see in the image the latex rendering isn't respecting the indentation

Expected behavior

The latex rendering should be indented just like everything else

Healthcheck output

1 ==============================================================================
    2 render-markdown:                     require("render-markdown.health").check()
    3 
    4 render-markdown.nvim [version] 
    5 - ✅ OK plugin 8.3.29
    6 - ✅ OK neovim >= 0.11
    7 
    8 render-markdown.nvim [configuration] 
    9 - ✅ OK valid
   10 
   11 render-markdown.nvim [treesitter] 
   12 - ✅ OK markdown: parser installed
   13 - ✅ OK markdown_inline: parser installed
   14 - ✅ OK latex: parser installed
   15 - ✅ OK html: parser installed
   16 - ✅ OK markdown: highlight enabled
   17 
   18 render-markdown.nvim [icons] 
   19 - ✅ OK using: nvim-web-devicons
   20 
   21 render-markdown.nvim [executables] 
   22 - ✅ OK latex2text: installed
   23 
   24 render-markdown.nvim [conflicts] 
   25 - ✅ OK headlines: not installed
   26 - ✅ OK markview: not installed
   27 - ✅ OK obsidian: not installed
   28

Plugin configuration

{
        'MeanderingProgrammer/render-markdown.nvim',

        ft = "markdown",

        opts = {
            indent = { enabled = true, skip_heading = false, render_modes = true, },
            html = { comment = {conceal = false}, },
            code = { border = 'thick', }, 
            latex = {top_pad = 0, bottom_pad = 1},
        }
    },

Plugin error log

N/A

Confirmations

  • I have updated this plugin to the latest version using my plugin manager
  • I have provided the text contained in all screenshots as raw text in this issue. This means if there is a screenshot below it is the copy pasted contents of the file in the screenshot. I understand that my issue will be closed if I have not.

Additional information

No response

@drzhivago420 drzhivago420 added the bug Something isn't working label May 8, 2025
MeanderingProgrammer added a commit that referenced this issue May 8, 2025
## Details

Issue: #421

This was a known issue since computing the indentation level requires us
to be in the `markdown` language tree, which `latex` is separated from
by 2 levels, `markdown` -> `markdown-inline` -> `latex`. Going between
language trees is not possible directly from the node.

To get around this we get the closest markdown node to the latex node's
position via:

```lua
vim.treesitter.get_node({
    bufnr = buf,
    pos = { node.start_row, node.start_col },
    lang = 'markdown',
})
```

Then using this node we can compute the indent using the `Indent`
module. This became a lot easier after separating this logic from the
`Base` render parent class, so we don't need to do any weird extension
for `latex` rendering.

Also modified the latex handler to create a class instance similar to
the other builtin handlers. Renamed all handler implementations to use
`run` for the main method name instead of `parse`.
@MeanderingProgrammer
Copy link
Owner

Added support for this here: 006806e

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