|
| 1 | +Contributing to lua-filters |
| 2 | +=========================== |
| 3 | + |
| 4 | +Happy to have you here! Below you can find guidance on the |
| 5 | +best way to contribute to this collection of Lua filters. |
| 6 | + |
| 7 | +Bugs reports and feature requests |
| 8 | +--------------------------------- |
| 9 | + |
| 10 | +All contributions are welcome! |
| 11 | + |
| 12 | + |
| 13 | +Please report all bugs on the |
| 14 | +GitHub [issue tracker]. |
| 15 | + |
| 16 | +Please note that all filters *usually* target the latest pandoc |
| 17 | +version, although we may lag behind sometimes. It is considered a |
| 18 | +bug if a filter produces wrong results for the latest pandoc |
| 19 | +version; older pandoc versions are not necessarily supported, |
| 20 | +although we usually strive to do so. |
| 21 | + |
| 22 | +A bug report is most useful if it gives detailed, *reproducible* |
| 23 | +instructions. Additionally, it should include |
| 24 | + |
| 25 | + * the pandoc version, |
| 26 | + * the exact command line used, |
| 27 | + * the exact input used, |
| 28 | + * the output received, and |
| 29 | + * the output you expected instead. |
| 30 | + |
| 31 | +This will allow us to help you more quickly. |
| 32 | + |
| 33 | +Pull requests |
| 34 | +------------- |
| 35 | + |
| 36 | +Whether a small patch or a full new filters, we love getting pull |
| 37 | +requests. Consistency is important, especially for a project with |
| 38 | +multiple parts written by many contributors. That's why PRs should |
| 39 | +follow the filter structure outlined below. |
| 40 | + |
| 41 | +Filter Structure |
| 42 | +---------------- |
| 43 | + |
| 44 | +The filters come with these components: |
| 45 | + |
| 46 | +- `README.md` describing the filter; if the filter depends on |
| 47 | + additional programs, the document should list those requirements |
| 48 | + and describe how they can be installed. |
| 49 | + |
| 50 | + Please keep in mind that a key design goal of Markdown was |
| 51 | + readability. The README should be pleasant to read even as plain |
| 52 | + text. This includes keeping lines below 80 chars or, better yet, |
| 53 | + below 66 chars. |
| 54 | + |
| 55 | +- The main Lua filter script; besides the code, it should also |
| 56 | + contain a small header with author, copyright, and licensing |
| 57 | + information. All filters must be licensed under the MIT license. |
| 58 | + |
| 59 | + Lua code should follow the Olivine Labs [Lua style guide]. The |
| 60 | + tl;dr is: use snake_case for most names and keep lines below 80 |
| 61 | + chars. |
| 62 | + |
| 63 | +- `Makefile` to run the tests. The only hard requirement is the |
| 64 | + existence of a `.PHONY` target named `test` which can be used to |
| 65 | + test correctness. |
| 66 | + |
| 67 | +- `sample.md` or a similar file demonstrating how the filter can |
| 68 | + be used. The sample file doubles as test input. |
| 69 | + |
| 70 | +- A file containing the expected output when using the filter on |
| 71 | + the sample input. Multiple such files can be provided if |
| 72 | + different filter configurations are to be tested. |
| 73 | + |
| 74 | +All components should be bundled in a single directory. |
| 75 | + |
| 76 | +### Configuration |
| 77 | + |
| 78 | +Filters are expected to be readily usable by a wide range of |
| 79 | +users. It should not be necessary to edit any source files, so it |
| 80 | +often makes sense to keep a filter configurable. |
| 81 | + |
| 82 | +There are two main methods to configure a filter: environment |
| 83 | +variables and special metadata values. The `diagram-generator` |
| 84 | +filter supports both and can serve as a good reference. |
| 85 | + |
| 86 | +Commits |
| 87 | +------- |
| 88 | + |
| 89 | +Please follow the usual guidelines for git commits: keep commits |
| 90 | +atomic, self-contained, and add a brief but clear commit message. |
| 91 | +This [guide](https://chris.beams.io/posts/git-commit/) by Chris |
| 92 | +Beams is a good resource if you'd like to learn more. |
| 93 | + |
| 94 | + |
| 95 | +[issue tracker]: https://github.com/pandoc/lua-filters/issues |
| 96 | +[Lua style guide]: https://github.com/Olivine-Labs/lua-style-guide |
0 commit comments