GithubHelp home page GithubHelp logo

markdown_toc's Introduction

MDtoc: MarkDown ToC Vim Plugin

MDtoc is a Vim plugin intended to ease the creation of Table of Contents in MarkDown files. It started as a simple "make a command to turn text into a slug", then evolved into a "turn text into an anchor link", until finally becoming a full blown plugin.

Contents

  1. Features
  2. Installation

Features

The plugin offers the following commands:

  • :'<,'>Slug is used in visual mode to convert the selected text into a slug.

  • :'<,'>Slurl is used in visual mode to convert the selected text into an anchor link pointing to a header with the same text. The idea was to copy a header to ToC and then convert that copy to a link.

  • :MDtoc is used in normal mode to create the current document's ToC.
    It parses the document from the current cursor position down to the end, recognises headers marked with any number of hash (#) signs (no --- and === support, sorry), creates a ToC, and inserts it where the cursor is, also removing the existing ToC, if one already exists.

  • :MDtocd is used in normal mode to create the current directory's ToC (the d in the name stands for "directory"). It parses the directory in which the file is saved and generates a joint ToC for all the files in that directory, skipping only the current file and those with names starting with _ and ..

Installation

Just put markdown_toc.vim in file-type plugin directory (on Linux, it is usually ~/.vim/ftplugin/). This will make the plugin active (and thus the above functions available) in all documents recognised by Vim as MarkDown (but not any others).

If you prefer to clone this repository and link the plugin from there (possibly for modifications to the code), you can do something like this on Linux:

git clone [email protected]:vsego/markdown_toc.git
ln -sr markdown_toc/markdown_toc.vim ~/.vim/ftplugin/

markdown_toc's People

Contributors

vsego avatar

Stargazers

Ghislain Rodrigues avatar

Watchers

 avatar

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.