Skip to content
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

jumping to underlined headers doesn't work #140

Closed
2 of 6 tasks
m-fonseca opened this issue Mar 31, 2021 · 4 comments
Closed
2 of 6 tasks

jumping to underlined headers doesn't work #140

m-fonseca opened this issue Mar 31, 2021 · 4 comments
Assignees
Labels
bug:report Something does not work as intended / expected.

Comments

@m-fonseca
Copy link

m-fonseca commented Mar 31, 2021

OS type:

  • Unix
  • Windows
  • Other ([SPECIFY])

Vim:

  • vim
  • neovim
  • Other ([SPECIFY])

Vim version:
NVIM v0.4.4

Using mkdx 602a784

Reproduce steps:

Use the following markdown file.

Title
=====

# Table of Contents

- [Title](#title)
- [Table of Contents](#table-of-contents)
    - [Head1](#head1)
        - [Head2](#head2)
            - [Head3](#head3)

Head1
-----

### Head2

#### Head3
  1. Jumping to each heading from the table of contents is possible except for Head1

Expected:

Jumps to Head1

Actual:

Doesn't jump to Head1

Thanks!

@SidOfc SidOfc self-assigned this Apr 1, 2021
@SidOfc SidOfc added the bug:report Something does not work as intended / expected. label Apr 1, 2021
@SidOfc
Copy link
Owner

SidOfc commented Apr 1, 2021

I see, yeah this should indeed work with setex style headings, will look into it, cheers 👍

@SidOfc SidOfc closed this as completed in 6d06c4c Apr 7, 2021
@SidOfc
Copy link
Owner

SidOfc commented Apr 7, 2021

And hello again @m-fonseca, setex style headers should now also work, feel free to reopen if you still experience issues.

@m-fonseca
Copy link
Author

Awesome. Thanks for all your work on these. I did encounter another problem that's related, but you might consider another bug. (If you think so, I can open a separate issue).

If you use the same markdown file with no table of contents (don't just delete it and stick it back in, make sure its deleted, save it and exit, and then open it again), and then insert the table of contents, you can't jump to head2 and head3, but as soon as you save it, the the links will work.

I.e. you can't jump to level 3 & 4 headers without saving first.

@SidOfc
Copy link
Owner

SidOfc commented Apr 8, 2021

@m-fonseca yeah this is indeed a side effect which has to do with how mkdx find these headers.

Viml isn't the fastest language out there so to compensate, mkdx uses grep in a background job to speed things up.
Because of this, the buffer needs to be written to disk because grep doesn't work on the in-memory file.

The reason it does work for setex style headers is because this is a lot trickier to implement with grep since they span more than one line (text line followed by - / =), so there I decided to use the native language features.

In any case I don't think this is something I want to change or fix, it's always good to save your changes at any point in time (I save literally tons of times since I'm a bit paranoid of losing work in case of editor / pc crash or power outage).

Cheers for pointing it out though 👌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug:report Something does not work as intended / expected.
Projects
None yet
Development

No branches or pull requests

2 participants