You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Every bit of sponsorship helps, whether it's to buy me a coffee or to enable me to dedicate more
22
+
time to maintaining and improving this project. I sincerely appreciate your generosity and support!
14
23
15
24
# TLDR
16
25
17
-
1. Choose a name for your project, i.e. `${VIMDOC_PROJECT_NAME}`. See [.github/workflows/panvimdoc.yml](./.github/workflows/panvimdoc.yml) as an example.
26
+
1. Choose a name for your project, i.e. `${VIMDOC_PROJECT_NAME}`. See
27
+
[.github/workflows/panvimdoc.yml](./.github/workflows/panvimdoc.yml) as an example.
18
28
2. Add the following to `./.github/workflows/panvimdoc.yml`:
19
29
20
30
```yaml
@@ -85,8 +95,9 @@ jobs:
85
95
incrementheadinglevelby: 0 # Increment heading levels by specified number
86
96
```
87
97
88
-
The only required thing for you to do is to choose a `VIMDOC_PROJECT_NAME` appropriately.
89
-
This is usually the name of the plugin or the documentation file without the `.txt` extension. For example, the following:
98
+
The only required thing for you to do is to choose a `VIMDOC_PROJECT_NAME` appropriately. This is
99
+
usually the name of the plugin or the documentation file without the `.txt` extension. For example,
100
+
the following:
90
101
91
102
```yaml
92
103
- name: panvimdoc
@@ -95,12 +106,13 @@ This is usually the name of the plugin or the documentation file without the `.t
95
106
vimdoc: panvimdoc
96
107
```
97
108
98
-
will output a file `doc/panvimdoc.txt` and the vim help tag for it will be `panvimdoc` using the `main` branch of the repository.
109
+
will output a file `doc/panvimdoc.txt` and the vim help tag for it will be `panvimdoc` using the
110
+
`main`branch of the repository.
99
111
100
112
All the other options are optional.
101
113
102
-
It is recommended to pin to an exact version so you can be confident that no surprises occur for you or your users.
103
-
See <https://github.com/kdheepak/panvimdoc/releases/latest> for which version to use.
114
+
It is recommended to pin to an exact version so you can be confident that no surprises occur for you
115
+
or your users. See <https://github.com/kdheepak/panvimdoc/releases/latest> for which version to use.
104
116
Once you pick a version, you can pin it like so:
105
117
106
118
```yaml
@@ -111,13 +123,16 @@ Once you pick a version, you can pin it like so:
111
123
For an example of how this is used, see one of the following workflows:
If you are interested in making your vim plugin documentation available as a HTML page, check out [.github/workflows/docs.yml](./.github/workflows/docs.yml) file.
134
+
If you are interested in making your vim plugin documentation available as a HTML page, check out
--lua-filter=scripts/skip-blocks.lua -t html -o public/index.html
158
164
- name: deploy to GitHub pages
159
165
uses: JamesIves/github-pages-deploy-action@v4
160
166
with:
@@ -192,73 +198,98 @@ You will need `pandoc v3.0.0` or greater for this script to work.
192
198
193
199
# Motivation
194
200
195
-
Writing user-friendly documentation is important for every successful software project.
196
-
This is particularly true when writing documentation for users in the world of vim plugins.
201
+
Writing user-friendly documentation is important for every successful software project. This is
202
+
particularly true when writing documentation for users in the world of vim plugins.
197
203
198
-
The process of writing and maintaining this documentation can often be a cumbersome, time-consuming task.
199
-
This project is aims to make that process a little bit easier by allowing anyone to write documentation in markdown (or any format Pandoc supports) and converting it to vimdoc automatically.
200
-
This way, plugin authors will have to write documentation just once (for example, as part of the README of the project), and the vim documentation can be autogenerated.
204
+
The process of writing and maintaining this documentation can often be a cumbersome, time-consuming
205
+
task. This project is aims to make that process a little bit easier by allowing anyone to write
206
+
documentation in markdown (or any format Pandoc supports) and converting it to vimdoc automatically.
207
+
This way, plugin authors will have to write documentation just once (for example, as part of the
208
+
README of the project), and the vim documentation can be autogenerated.
201
209
202
210
## Rationale
203
211
204
-
1. **Simplicity**: Writing in Markdown is often more intuitive for developers. By converting from Markdown to vimdoc, authors can maintain the simplicity of Markdown while adhering to the vimdoc standards.
205
-
2. **Unified Documentation**: Plugin authors can write their documentation just once (such as in the project's README) and automatically generate vim documentation, ensuring consistency and saving time.
206
-
3. **Preserving Vim Features**: Vimdoc isn’t just plain text; it supports syntax highlighting, tags, links, and careful formatting using whitespace. It's essential to preserve these features when converting to ensure the quality and usefulness of the documentation. See <https://vimhelp.org/helphelp.txt.html#help-writing> or [`@nanotree`'s project](https://github.com/nanotee/vimdoc-notes) for more information.
207
-
4. **Leveraging Pandoc**: Unlike existing solutions, this project leverages Pandoc's wide range of features, including support for multiple Markdown flavors and easy-to-write custom filters in Lua.
208
-
5. **Interoperability**: The choice of Pandoc allows for enhanced flexibility, making it easier to extend functionality or even adapt the converter for other documentation formats in the future.
212
+
1. **Simplicity**: Writing in Markdown is often more intuitive for developers. By converting from
213
+
Markdown to vimdoc, authors can maintain the simplicity of Markdown while adhering to the vimdoc
214
+
standards.
215
+
2. **Unified Documentation**: Plugin authors can write their documentation just once (such as in the
216
+
project's README) and automatically generate vim documentation, ensuring consistency and saving
217
+
time.
218
+
3. **Preserving Vim Features**: Vimdoc isn’t just plain text; it supports syntax highlighting, tags,
219
+
links, and careful formatting using whitespace. It's essential to preserve these features when
220
+
converting to ensure the quality and usefulness of the documentation. See
221
+
<https://vimhelp.org/helphelp.txt.html#help-writing> or
222
+
[`@nanotree`'s project](https://github.com/nanotee/vimdoc-notes) for more information.
223
+
4. **Leveraging Pandoc**: Unlike existing solutions, this project leverages Pandoc's wide range of
224
+
features, including support for multiple Markdown flavors and easy-to-write custom filters in
225
+
Lua.
226
+
5. **Interoperability**: The choice of Pandoc allows for enhanced flexibility, making it easier to
227
+
extend functionality or even adapt the converter for other documentation formats in the future.
209
228
210
229
## Background
211
230
212
231
Writing documentation in Markdown and converting it to vimdoc is not a novel idea.
213
232
214
-
For example, [ibhagwan/ts-vimdoc.nvim](https://github.com/ibhagwan/ts-vimdoc.nvim) is an implementation a neovim treesitter based markdown to vimdoc converter that works fairly well.
215
-
There are no dependencies except for the Markdown treesitter parser.
216
-
It is neovim only but you can use this on github actions even for a vim plugin documentation.
233
+
For example, [ibhagwan/ts-vimdoc.nvim](https://github.com/ibhagwan/ts-vimdoc.nvim) is an
234
+
implementation a neovim treesitter based markdown to vimdoc converter that works fairly well. There
235
+
are no dependencies except for the Markdown treesitter parser. It is neovim only but you can use
236
+
this on github actions even for a vim plugin documentation.
217
237
218
238
There's also [wincent/docvim](https://github.com/wincent/docvim) which is written in Haskell.
219
239
Finally there's [FooSoft/md2vim](https://github.com/FooSoft/md2vim) which is written in Go.
220
240
221
-
None of these projects use Pandoc.
222
-
Pandoc Markdown supports a wide number of features: See <https://pandoc.org/MANUAL.html> for more information.
223
-
Most importantly, it supports a range of Markdown formats and flavors.
224
-
And, Pandoc has filters and a custom output writer that can be configured in lua.
225
-
Pandoc filters can extend the capability of Pandoc with minimal lua scripting, and these are very easy to write and maintain too.
241
+
None of these projects use Pandoc. Pandoc Markdown supports a wide number of features: See
242
+
<https://pandoc.org/MANUAL.html> for more information. Most importantly, it supports a range of
243
+
Markdown formats and flavors. And, Pandoc has filters and a custom output writer that can be
244
+
configured in lua. Pandoc filters can extend the capability of Pandoc with minimal lua scripting,
245
+
and these are very easy to write and maintain too.
226
246
227
-
That means, with this project, you can write your Vim documentation in Markdown, RestructuredText, AsciiDoc, etc and convert it to VimDoc, PDF, Word, HTML etc.
247
+
That means, with this project, you can write your Vim documentation in Markdown, RestructuredText,
248
+
AsciiDoc, etc and convert it to VimDoc, PDF, Word, HTML etc.
228
249
229
250
# Goals
230
251
231
-
By offering a specification and reference implementation for converting Pandoc Markdown to vimdoc, this project aims to reduce friction in the documentation process for vim plugin authors.
252
+
By offering a specification and reference implementation for converting Pandoc Markdown to vimdoc,
253
+
this project aims to reduce friction in the documentation process for vim plugin authors.
232
254
233
255
Here are the specific goals that guide this project:
234
256
235
-
- **Readability**: The Markdown files must render correctly when presented as README files on platforms like GitHub, GitLab, or SourceHut.
236
-
- **Web-Friendly HTML**: If converted to HTML using Pandoc, the Markdown files must be web-friendly and render appropriately.
237
-
- **VimDoc Features**: The generated vim documentation must support essential features like links and tags.
238
-
- **Aesthetically Pleasing**: The vim documentation must not only be functional but also visually pleasing in both vim and plain text files. This includes the appropriate use of columns and spacing.
239
-
- **Guidelines**: While the format of built-in Vim documentation is a valuable reference, it is used as guidelines rather than strict rules.
257
+
- **Readability**: The Markdown files must render correctly when presented as README files on
258
+
platforms like GitHub, GitLab, or SourceHut.
259
+
- **Web-Friendly HTML**: If converted to HTML using Pandoc, the Markdown files must be web-friendly
260
+
and render appropriately.
261
+
- **VimDoc Features**: The generated vim documentation must support essential features like links
262
+
and tags.
263
+
- **Aesthetically Pleasing**: The vim documentation must not only be functional but also visually
264
+
pleasing in both vim and plain text files. This includes the appropriate use of columns and
265
+
spacing.
266
+
- **Guidelines**: While the format of built-in Vim documentation is a valuable reference, it is used
267
+
as guidelines rather than strict rules.
240
268
241
269
# Features
242
270
243
-
This project offers a comprehensive suite of features designed to streamline the conversion process from Markdown to vimdoc:
271
+
This project offers a comprehensive suite of features designed to streamline the conversion process
272
+
from Markdown to vimdoc:
244
273
245
274
- Automatically generates titles for vim documentation.
246
275
- Creates a table of contents to enhance navigation within the document.
247
276
- Automatically handles the generation of links and tags.
248
277
- Maintains markdown syntax for tables, ensuring proper rendering.
249
278
- Allows for manual control through raw vimdoc syntax where necessary.
250
-
- Offers the ability to include multiple Markdown files, providing flexibility in documentation structure.
279
+
- Offers the ability to include multiple Markdown files, providing flexibility in documentation
280
+
structure.
251
281
252
282
# Specification
253
283
254
-
The specification is described in [panvimdoc.md](./doc/panvimdoc.md) along with examples.
255
-
The generated output is in [panvimdoc.txt](./doc/panvimdoc.txt).
256
-
The reference implementation of the Pandoc lua filter is in [panvimdoc.lua](./scripts/panvimdoc.lua).
257
-
See [panvimdoc.sh](./panvimdoc.sh) for how to use this script, or check the [Usage](#usage) section.
284
+
The specification is described in [panvimdoc.md](./doc/panvimdoc.md) along with examples. The
285
+
generated output is in [panvimdoc.txt](./doc/panvimdoc.txt). The reference implementation of the
286
+
Pandoc lua filter is in [panvimdoc.lua](./scripts/panvimdoc.lua). See [panvimdoc.sh](./panvimdoc.sh)
287
+
for how to use this script, or check the [Usage](#usage) section.
258
288
259
289
<!-- panvimdoc-ignore-start -->
260
290
261
-
If you would like to contribute to the specification, or if you have feature requests or opinions, please feel free to comment here: <https://github.com/kdheepak/panvimdoc/discussions/11>.
291
+
If you would like to contribute to the specification, or if you have feature requests or opinions,
292
+
please feel free to comment here: <https://github.com/kdheepak/panvimdoc/discussions/11>.
0 commit comments