Closed bdgong closed 6 years ago
Already have a similar issue, I should close it.
I change to iamcco/markdown-preview
, now I can navigate between level 2 headers '##', but not lower headers, like '###'.
I just test for it, in my environment I can navigate between level 2/3/4/5... headers well. Could you provide a markdown content snippets to reproduce your problem?
ps: iamcco/markdown-preview
use https://github.com/markedjs/marked as its Markdown Parser, the support for it has not been tested. I guess the reason is there are some symbols in your header, and different markdown parsers generate different anchor links for a same header.
https://gitee.com/bdgong/tech-notes/blob/master/book/note__JavaConcurrencyInPractice.md
So, how could I see the anchor the Parser generated? or, I can not
Anyway, which vim plugin you use to preview markdown?
Just use Chrome devtools, the id
value is anchor.
anchors generated for header 2.4 Guarding State with Locks
:
iamcco/markdown-preview: 2.4-guarding-state-with-locks
gitee: 24-guarding-state-with-locks
Redcarpet: 2-4-guarding-state-with-locks
They all different from others. So I give up to find a tool which can preview markdown with toc links are right. I just confirm styles.
ps: If you want to upload markdown to gitee, use command :GenTocGitLab
may better.
OK, thank you very much~
I am not familiar with vimscript, but I'm wondering whether I could modify your code to achieve my goals. Could just give some tips? Appreciate for your help
Sadly you can't generate toc once, work well in all of markdown preview, GitHub, Gitee, or even any two of them.
If you just want to use toc in markdown preview, maybe we can add a command :GenTocMarked
for iamcco/markdown-preview, like :GenTocGFM
for GitHub, :GenTocGitLab
for GitLab. You can ref https://github.com/mzlogin/vim-markdown-toc/blob/a6e227023f405a7c39590a8aaf0d54dde5614a2e/ftplugin/markdown.vim#L126 for how to implement.
That's what I need, thank you
You are welcome. And...welcome to PR for this if you implement it. 😆
Use
Vundle
to manage my vim plugins. Usevim-instant-markdown
to preview markdown. Since I knowvim-markdown-toc
is a good plugin then just have a try, but I can only generate ToC withvim-markdown-toc
, click any title, just can not navigate to the content?