Git Product home page Git Product logo

vim-markdown-toc's Issues

GFM ordered list style not honored when using custom list_item_char `1.`

First off

Thanks for this great plugin. I know GFMs way of handling ordered lists is pretty weird, but it still would be nice if this plugin could handle it out of the box.

Issue

I want a numbered TOC. I achieved this by following the advice in this issue on vimwiki, setting g:vmt_list_item_char = '1.'.

This seems to work fine, but GFM is acting very rude, requiring 4 whitespaces of indentation in sublevels. To save some energy, I tried not to be so mad about that.

I inserted the following option in my vimrc as a workaround: g:vmt_list_indent_text = repeat(' ', 4). This is good for now, but I think it would be great to support numbered lists in general.

One issue now is, that if I want to change my item char back to e.g. -, I have to change indent text as well, or live with inconsistent indentation in my document, as my usual shiftwidth is 2 for markdown.

Also, if I use this TOC in other markdown formats, where two whitespaces are permitted, my hardcoded intent text will still be picked up.

Feature request

So my minor suggestions, with low prio, is to offer a global flag to generate numbered TOC. Use 1. as a prefix in this case. This global flag could then be checked for in s:GetIndentText. If it's true AND GFM style is used AND &expandtab is not set, don't use the &shiftwidth, but rather 4 whitespaces. Otherwise use tab or shiftwidth.

Q: Is vim-markdown-toc abandoned, dead? (A: Yes)

Last PR over 18 months ago.

Last closed issue over a year ago.

No responses to any Issues.

vim-markdown-toc is not working at all for me (installled, but vim will not acknowledge that it is there), but no point in raising an issue.

插件无法工作

系统:windows10
vim版本:vim 8.2
错误提示:输入:GenTocGFM后提示 E492:不是编辑器的命令: GentocGFM
_vimrc:
set rtp+=$VIM\vimfiles\bundle\Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'tpope/vim-fugitive'
Plugin 'airblade/vim-gitgutter'
Plugin 'tpope/vim-surround'
Plugin 'scrooloose/nerdcommenter'
Plugin 'scrooloose/nerdtree'
Plugin 'jistr/vim-nerdtree-tabs'
Plugin 'zxqfl/tabnine-vim'
Plugin 'godlygeek/tabular'
Plugin 'plasticboy/vim-markdown'
Plugin 'mzlogin/vim-markdown-toc'
Plugin 'iamcco/markdown-preview.vim'
call vundle#end()

Update toc should not change the undotree

When use this plugin to edit a md file, after saving file, the toc is updated, but when I type u the cursor move to the toc menu, I think the undotree of current file is been updated.

Removing existed insert fence, then UpdateToc manually raises error.

Error detected while processing function <SNR>120_UpdateToc[5]..<SNR>120_DeleteExistingToc:
line   29:
Cannot find toc begin fence
Error detected while processing function <SNR>120_UpdateToc:
line    8:
Cannot find existing toc

It's noted that insert fence followed is neccessay for auto save, but I don't need it and like running :UpdateToc manually, in which situation the error above occurs. I think it should be coverd.

<!-- vim-markdown-toc GFM -->
toc
<!-- vim-markdown-toc -->

links generated for sections with hyphens not working for Gitlab

Since you do not support GitLab, my issue is mor a backlog for other users.

Since GitHub keeps hyphens and GitLab deletes them when converting a header to an anchor.

The following code is valid for GitHub but not for GitLab

# Test code
<!-- vim-markdown-toc GFM -->

* [This subsection has an - in it](#this-subsection-has-a---in-it)

<!-- vim-markdown-toc -->

## This subsection has a - in it

To make it work, I had to add the following regex in GetHeadingLinkGFM (line 123):

let l:headingLink = substitute(l:headingLink, "-\\+", "-", "g")  # Converts successive hyphens to only one

Maybe you could easily add support for GitLab too, rules to create header anchors are summarized here.

The file generating anchors for headers in GitHub is to be found here. I'm not proficient in ruby but I don't see anything about deleting successive hyphens.

Option to use tabs rather than spaces?

It seems that vim-markdown-toc always uses hard tabs to indent subsections within a table of contents, even if expandtab is turned on in vim (and thus the user prefers spaces). It would more be elegant and fit in better with the users' other preferences if it honored that option.

Thanks for your fine work on this plugin!

ctag无法处理markdown文档

我在网上看到你的文字,想请问以下,我通过网上的步骤设置ctag和markdown2ctag后还是无法看到md文档的大纲。请问你知道怎样排错吗?谢谢。

TOC links with non ascii characters

I'm using pandoc to convert my markdown files to HTML format. When using :GenTocRedcarpet command, generated TOC links looks like:
[Wstępna konfiguracja karty](#wstępna-konfiguracja-karty)

Pandoc creates <h> tags that looks like:
<h2 id="wstepna-konfiguracja-karty">Wstępna konfiguracja karty</h2>

As you see, there are no letters other than ascii characters inside id attribute.

Is it possible to to pass link part of TOC through command like iconv -t ascii//TRANSLIT, so letters like ę, ą, ś will be replaced by e, a, s?

Regards,

Andrzej.

Keep undo history

It would be cool if TOC modification done automatically done on save won't be added to undo history, so :w and u will undo last change user has done before saving, not TOC modification.

As example, https://github.com/fatih/vim-go plugin correctly does this while reformatting code on save by running external tools like gofmt or goimports.

generate wrong toc

src:

# hello


<!-- vim-markdown-toc GFM -->
            * [heading1](#heading1)
* [](#)

<!-- vim-markdown-toc -->

## heading1

##

Error with Vimwiki: Range too large in character class

Does anyone use Vimwiki with VMT? I just upgraded my instance of Vimwiki to 2.5 and now, any generated TOC link caused the following error when jumping to the item it points to:

Error Detected while processing function vimwiki#base#follow_link[69] .. vimwiki#base#open_link[34] .. vimwiki#base#edit_file[32] .. <SNR>46_jump_to_anchor[12] .. <SNR>46_jump_to_segment: 
line 23:
E945: Range to large in character class

However, I have no problem jumping from links generated by Vimwiki. Any pointer on how to investigate this error further?

Best,
Yohannes

Add option to enable for different filetypes

I'm using vimwiki with markdown syntax.

To generate the html I'm using livedown which itself uses marked.

That works great with using :GenTocRedcarpet. The only problem is that I have to run :set ft=markdown so that this plug loads and then run :set ft=vimwiki to use all the vimwiki features.

Once I've done that I can use :UpdateToc and it works great. Long story short I'd love to have option that lets me load this plugin for a different filetype than markdown.

How to remove TOC ?

I generated the TOC and its working well .. For now I want to remove it till I finish formatting t he document and then regenerate the TOC .. Is there a command for removing the TOC ?

Thanks in advance

Add a black line before toc

in the latest version of this plugin, the toc is looks like

<!-- vim-markdown-toc GFM -->
* [安装](#安装)
* [更新](#更新)
* [文档](#文档)
    * [核心**](#核心**)
        * [记忆辅助](#记忆辅助)
        * [可视化交互](#可视化交互)
        * [一致性](#一致性)
        * [社区驱动](#社区驱动)

<!-- vim-markdown-toc -->

but, after use remark to formate markdown file, it looks like:

<!-- vim-markdown-toc GFM -->

- [安装](#安装)
- [更新](#更新)
- [文档](#文档)
  - [核心**](#核心**)
    - [记忆辅助](#记忆辅助)
    - [可视化交互](#可视化交互)
    - [一致性](#一致性)
    - [社区驱动](#社区驱动)

<!-- vim-markdown-toc -->

I think it looks better, maybe you do not need to change the list item from * to -, but an option can be added for it.

for more info see https://github.com/wooorm/remark/tree/master/packages/remark-stringify#optionslistitemindent

and I will try to send a PR for this issue, and the previous issue I have opened.

Wrong parsing in comment

I made this kind of python syntax highlighting codes in a markdown file.

Then this plugin thinks that the "# mod1.py" is a heading level 1.
Can you skip that kind of syntax highlighting blocks?

# mod1.py
def add(a, b):
    return a + b


def sub(a, b):
    return a - b

ignore heading in code blocks

If a markdown file contains python code block, and the block has comments lines begin with #, the comments will add to the TOC, it is not matching expect.

Invalid range error

I'm not sure if I did something wrong, but every time I try to generate the TOC or run :UpdateToc, I am getting this error:

2016-11-21 0 21 02

The TOC is still getting generated correctly, just this error appears. I am using silent! now to ignore the error. Any thoughts?

Delete part of document when folded on save

Looks like if TOC is inside folded block then whole block is deleted while auto-updating TOC on save and TOC is added few lines below deleted block. For example (require foldutil plugin), starting from document:

# test

<!-- vim-markdown-toc GitLab -->

* [one](#one)
* [two](#two)
    * [subtwo](#subtwo)
* [three](#three)

<!-- vim-markdown-toc -->

## one

## two

### subtwo

## three

Doing :w makes no change, but after :FoldMatching ^# -1 next :w will change document to:

## one

<!-- vim-markdown-toc GitLab -->

* [two](#two)
    * [subtwo](#subtwo)
* [three](#three)

<!-- vim-markdown-toc -->
## two

### subtwo

## three

trim trailing space

bad case:

### 2. ```git status -s```  

expect link

#2-git-status--s

but now result is

#2-git-status--s-

Can not navigate to the content when click title

Use Vundle to manage my vim plugins. Use vim-instant-markdown to preview markdown. Since I know vim-markdown-toc is a good plugin then just have a try, but I can only generate ToC with vim-markdown-toc, click any title, just can not navigate to the content?

Generate ordered list of contents

I find a numerically ordered toc more useful than an unordered list; the document has an order and sections are usually arranged in order.

Could we have an option to generate an ordered list instead of an unordered one?

eg:

1. Features
2. Installation
3. Usage
    1. Generate table of contents
    2. Update existing table of contents

please add a new feature of updating existing toc

First of all, thanks for your good work, it's very convenient to generate toc now. If you add a new feature like updating existing toc when triggering some hotkeys, it would be more useful. Is it right?
I have no vim script programming experience, but I think this is a good idea for some document which contains a long table of contents. If you add a updating-toc feature, we don't have to delete existing toc again. And I think inserting toc before the document is finished is useful too, because it can help us navigate the document.
So I think add a updating-toc feature is very useful. Thanks!

include section the toc is under in the toc

Currently it looks like the plugin ignores all headings above the point where you insert it. This leads to the case that when it is inserted under a # heading and after the toc comes a ## heading, the generated markdown list starts with an indentation, which will not be rendered as part of the list. Therefore the plugin should have an option to also include all the headings that are before its insert point

[Feature Request] Option to add line number on TOC generation, for quick item navigation (ex.: 35g)

First of all, thank you for the work invested on this plugin, and for sharing it with us!

The issue

Quickly navigate to a markdown TOC item corresponding section using vim line numbers: 35g

The feature

Provide the hability for the vim-markdown-toc to add the relative item line number before or after each TOC item.

Providing an option like:

let g:vmt_add_line_number_reference = 1

...that would add the line number and deliver something like this:

<!--- vim-markdown-toc GFM -->

line   5     * Introduction
line  35       ** How To Install
line  45       ** Hello World

<!-- /vim-markdown-toc -->

With a feature like that would be super cool quick and easy to navigate within the markdown file with vim native support.

I appreciate your time on considering that!

插件不起作用的问题

由于你的插件自动集成了vim对markdown的支持,我安装后由于插件冲突找了一上午原因,原谅我在这吐槽,你应该在github和文章开头介绍以下,需要注释或者删除

"Plugin 'godlygeek/tabular'"
Plugin 'plasticboy/vim-markdown'

这两个插件,被弄的好蛋疼

toc跳转问题

可以不用打开Toc(:Toc)直接在markdown文件里面的Toc(:GenTocGFM)跳转到标题处吗?
比如说有一个链接是[title](#header-two),比如直接从这上面按回车就能跳转过去。

need an option to set listitemchars.

@mzlogin in spacevim, we use remark to format markdwon file. vim-markdown-toc generate toc like

<!-- vim-markdown-toc GFM -->

* [安装](#安装)
* [更新](#更新)
* [文档](#文档)
    * [核心**](#核心**)
        * [记忆辅助](#记忆辅助)
        * [可视化交互](#可视化交互)
        * [一致性](#一致性)
        * [社区驱动](#社区驱动)

<!-- vim-markdown-toc -->

but after using remark formatting current buffer, the toc change to

<!-- vim-markdown-toc GFM -->

- [安装](#安装)
- [更新](#更新)
- [文档](#文档)
  - [核心**](#核心**)
    - [记忆辅助](#记忆辅助)
    - [可视化交互](#可视化交互)
    - [一致性](#一致性)
    - [社区驱动](#社区驱动)

<!-- vim-markdown-toc -->

we need an option to keep the same format. I will try to add this feature.

generated toc for image heading is not expected

For example:

# ![Awesome Adb](./assets/title.png)

Now generated toc is:

* [![Awesome Adb](./assets/title.png)](#awesome-adbassetstitlepng)

Result excepted:

* [Awesome Adb](#-num)

Deep thinking:

Image format is ![describe](image-link), if describe is null, how to cover it?

If the head is a link, the toc generated is not expected.

For example :

### [vim-airline](https://github.com/vim-airline/vim-airline)

then the generated toc is :

###     * [[vim-airline](https://github.com/vim-airline/vim-airline)](#vim-airlinehttpsgithubcomvim-airlinevim-airline)

This will lead to a direct visit to the link. However, I hope it lead to the right position in the current page.

So, what I expected is :

### * [vim-airline](#vim-airline)

Configuration option missing from README.md

I wanted to indent table item with 2 spaces instead of 4 and found an option on script that does that and is missing in the documentation.

Change

let g:vmt_list_indent_text = ''

To

let g:vmt_list_indent_text = ' '

Prettier gaurds move

I’m not sure what is going on or the exact repro. The symptom is sometimes the prettier gaurds that were around my toc marks move. A “phychic debugging” is the toc is written a few lines below it’s original line. I’ve tried a few things to isolate this, but haven’t found a consistent repro. I think it’s more likely if I hit save above the TOC, as opposed to below it, but sometimes I get a repro below as well. See video.

A6D283B8-641C-40B9-A18F-8B1DE3337155

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.