2021-06-09 05:50:01 +00:00
|
|
|
# Md2Vim
|
2015-08-09 09:50:26 +00:00
|
|
|
|
2016-07-10 20:39:39 +00:00
|
|
|
Writing technical documentation for Vim extensions is not exciting; manually converting what you've just written in
|
|
|
|
[Markdown](https://daringfireball.net/projects/markdown/) to
|
2021-12-23 04:48:14 +00:00
|
|
|
[Vimdoc](http://vimdoc.sourceforge.net/htmldoc/usr_toc.html) format is even less fun. I grew tired of having to do this
|
2021-06-09 05:50:01 +00:00
|
|
|
repeatedly for my [Vim-ArgWrap](https://foosoft.net/projects/vim-argwrap/) extension and finally formally solved this
|
2021-12-23 04:48:14 +00:00
|
|
|
problem with a purpose-built tool. Maintainability, ease of use, and beautiful Vimdoc output were primary considerations
|
2021-06-09 05:50:01 +00:00
|
|
|
in Md2Vim's design.
|
2015-08-09 09:50:26 +00:00
|
|
|
|
2021-12-15 02:24:30 +00:00
|
|
|
[![Markdown source file](img/markdown-thumb.png)](img/markdown.png)
|
2021-12-23 04:48:14 +00:00
|
|
|
[![Vimdoc target file](img/vimdoc-thumb.png)](img/vimdoc.png)
|
2019-04-28 23:02:28 +00:00
|
|
|
|
2021-06-09 05:50:01 +00:00
|
|
|
## Installation
|
2015-08-09 09:50:26 +00:00
|
|
|
|
|
|
|
If you already have the Go environment and toolchain set up, you can get the latest version by running:
|
|
|
|
|
|
|
|
```
|
2023-12-05 04:04:20 +00:00
|
|
|
go install foosoft.net/projects/md2vim@latest
|
2015-08-09 09:50:26 +00:00
|
|
|
```
|
|
|
|
|
2021-12-15 02:24:30 +00:00
|
|
|
Otherwise, you can use the [pre-built binaries](https://github.com/FooSoft/md2vim/releases) from the project page.
|
2015-08-09 09:50:26 +00:00
|
|
|
|
2021-06-09 05:50:01 +00:00
|
|
|
## Usage
|
2015-08-09 09:50:26 +00:00
|
|
|
|
2016-01-10 02:41:15 +00:00
|
|
|
Executing Md2Vim with the `-help` command line argument will trigger online help to be displayed. The list below
|
|
|
|
provides a more detailed description of what the parameters do.
|
2015-08-09 09:50:26 +00:00
|
|
|
|
2021-12-23 04:48:14 +00:00
|
|
|
* `cols`
|
2015-08-09 09:50:26 +00:00
|
|
|
|
2021-12-23 04:48:14 +00:00
|
|
|
The number of columns used for laying out Vimdoc files to make them look as good as possible with your content.
|
2015-08-09 09:50:26 +00:00
|
|
|
Notice that file contents will not be wrapped to this value; this is purely for such things as horizontal rule
|
|
|
|
widths and help tag positioning. This defaults to 80, but that's a bit too narrow for some people.
|
|
|
|
|
2021-12-23 04:48:14 +00:00
|
|
|
* `desc`
|
2015-08-09 09:50:26 +00:00
|
|
|
|
|
|
|
Vim help files are supposed to start with the following two fields on the first line:
|
|
|
|
|
|
|
|
```
|
|
|
|
filename.txt Description of this help file's contents
|
|
|
|
```
|
|
|
|
|
2021-12-23 04:48:14 +00:00
|
|
|
The first field is the filename of the generated Vimdoc help file; the second is the description can you provide
|
2015-08-09 09:50:26 +00:00
|
|
|
with this parameter.
|
|
|
|
|
2021-06-13 19:04:53 +00:00
|
|
|
Multi line description can be written using `\n`.
|
|
|
|
|
2021-12-23 04:48:14 +00:00
|
|
|
* `norules`
|
2015-08-09 09:50:26 +00:00
|
|
|
|
|
|
|
By default, we generate horizontal rules above level 1-2 headings, as shown below:
|
|
|
|
|
|
|
|
```
|
|
|
|
================================================================================
|
|
|
|
Level 1 Heading
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
Level 2 Heading
|
|
|
|
```
|
|
|
|
If you don't like the way it looks you can turn it off.
|
|
|
|
|
2021-12-23 04:48:14 +00:00
|
|
|
* `notoc`
|
2015-08-09 09:50:26 +00:00
|
|
|
|
2015-08-19 09:19:43 +00:00
|
|
|
If you don't wish to generate a table of contents you should set this flag to opt out. The table of contents lists
|
|
|
|
all of the headings in the document and is always inserted before the beginning of document body.
|
2015-08-09 09:50:26 +00:00
|
|
|
|
2021-12-23 04:48:14 +00:00
|
|
|
* `pascal`
|
2015-08-09 09:50:26 +00:00
|
|
|
|
|
|
|
By default, all help tags get converted to lower case and space delimited words are joined with underscores.
|
|
|
|
|
|
|
|
```
|
|
|
|
rigellians-how_to_cook_for_fourty_humans
|
|
|
|
```
|
|
|
|
|
2021-12-23 04:48:14 +00:00
|
|
|
If you prefer the PascalCase way of doing things, set this flag and your output will look like this:
|
2015-08-09 09:50:26 +00:00
|
|
|
|
|
|
|
```
|
|
|
|
Rigellians-HowToCookForFourtyHumans
|
|
|
|
```
|
|
|
|
|
2021-12-23 04:48:14 +00:00
|
|
|
* `tabs`
|
2015-08-09 09:50:26 +00:00
|
|
|
|
|
|
|
If you don't like four space tabs for some reason you can change it to something else with this parameter.
|