1 # docvim: a documentation generator for Vim plug-ins
3 docvim is a documentation generator for Vim plug-ins, written in Haskell.
8 # Print Markdown-formatted help documentation for files in current directory
11 # Write Markdown README + Vim help text file for $PLUGIN
12 docvim -c ~/code/$PLUGIN ~/code/$PLUGIN/doc/$PLUGIN.txt ~/code/$PLUGIN/README.md
18 docvim - a documentation generator for Vim plug-ins
20 Usage: docvim [--version] [OUTFILES...] [-d|--debug] [-c|--directory DIRECTORY]
22 Generate documentation for a Vim plug-in
25 -h,--help Show this help text
26 --version Print version information
27 OUTFILES... Target file(s) for generated output (default:
29 -d,--debug Print debug information during processing
30 -c,--directory DIRECTORY Change to DIRECTORY before processing (default: ".")
31 -v,--verbose Be verbose during processing
44 " Docblocks start with a pair of double quotes, followed
45 " by standard Vim comments (with a double quote prefix)
46 " containing Markdown-like text and optional annotations
47 " that look like this:
50 " @command :Ack {pattern} {options}
54 ### Supported Markdown features
60 --- (Horizontal dividers)
67 fenced codeblocks (leading space syntax not supported)
70 
71 (becomes a link in vimdoc, but an image in markdown)
75 ### Unsupported Markdown syntax
78 *foo* (emphasis; turns into Vim doc targets instead)
80 *,+ (list syntax; just use - instead)
82 <html> (we don't want ambiguity with things like <leader> and so on)
102 ### Convenience wrappers
105 bin/accept # Accept current "golden" test output.
106 bin/docvim # Run the docvim executable.
107 bin/golden # Run just the "golden" tests.
108 bin/haddock # Produce Haddock documentation.
109 bin/lint # Run the linter.
110 bin/tasty # Run just the Tasty tests.
111 bin/test # Run all tests, including lints.
114 These are wrappers for the explicit invocations described below.
118 You can set-up a development environment using [Stack] (recommended) or [Cabal]:
122 brew install haskell-stack
126 brew install cabal-install
128 cabal install --only-dependencies --enable-tests
134 Run using `stack exec` (or `cabal run`) and passing in docvim-specific `OPTIONS`:
138 stack exec docvim [OPTIONS]
141 cabal run -- [OPTIONS]
144 You can also run the modules from inside the REPL:
149 > pp "let l:test=1" -- pretty-prints AST
153 > import Text.Docvim.Parse
154 > pp "let l:test=1" -- pretty-prints AST
160 stack build --file-watch
163 ### Building and viewing the code-level documentation
168 open .stack-work/dist/x86_64-osx/Cabal-1.22.5.0/doc/html/docvim/index.html
171 cabal haddock --executables
172 open dist/doc/html/docvim/docvim/index.html
179 stack test # Runs all test suites, including linting.
180 stack test :tasty # Runs just the Tasty test suite.
183 cabal test # Runs all test suites, including linting.
184 cabal test tasty # Runs just the Tasty test suite.
187 #### Updating "golden" files
191 stack test --test-arguments=--accept # Runs all test suites.
192 stack test :tasty --test-arguments=--accept # Runs just the Tasty test suite.
195 cabal test --test-options=---accept # Runs all test suites.
196 cabal test tasty --test-options=---accept # Runs just the Tasty test suite.
203 stack test # Runs linter as part of overall set of suites.
204 stack test :hlint # Runs linter alone.
207 cabal install hlint # (First-time only).
208 cabal test # Runs linter as part of overall set of suites.
209 cabal test hlint # Runs linter alone.
211 hlint src # If you have HLint installed under $PATH.
217 vim docvim.cabal # update version number in two places
218 git commit -p # git tag, git push --follow-tags etc...
221 open dist # upload candidate to https://hackage.haskell.org/packages/candidates/upload
222 cabal upload dist/docvim-$VERSION.tar.gz
227 - [Hackage package](https://hackage.haskell.org/package/docvim)
231 ### Why a new tool and not an existing one like [Vimdoc]?
233 * I wanted to target multiple output formats (Vim help files and Markdown).
234 * I wanted total control over the presentation of the output.
235 * It's fun to build new things from scratch.
236 * The project is a great fit for my learn-me-a-Haskell goal this year.
238 ### Why is it called "Docvim"?
240 "Vimdoc" was the first name that occurred to me when I started this project, but:
242 * The number one hit for "vimdoc" is [this online copy of Vim's own documentation](http://vimdoc.sourceforge.net/).
243 * The name "Vimdoc" is already taken by [a similar project](https://github.com/google/vimdoc).
245 So, in a remarkable flash of profound creativity, I settled on "Docvim" instead, which right now yields this pleasing search result:
247 > Did you mean: dacvim
249 [Cabal]: https://www.haskell.org/cabal/
250 [Stack]: http://haskellstack.org/
251 [Vimdoc]: https://github.com/google/vimdoc