|
| 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 | +Contributions are welcome! |
| 7 | + |
| 8 | +Bugs reports and feature requests |
| 9 | +--------------------------------- |
| 10 | + |
| 11 | +We are happy to receive feature request or bug reports on the |
| 12 | +GitHub [issue tracker]. |
| 13 | + |
| 14 | +Please note that all filters *usually* target the latest pandoc |
| 15 | +version, although we may lag behind sometimes. It is considered a |
| 16 | +bug if a filter produces wrong results for the latest pandoc |
| 17 | +version; older pandoc versions are not necessarily supported, |
| 18 | +although we usually strive to do so. |
| 19 | + |
| 20 | +A bug report is most useful if it gives detailed, *reproducible* |
| 21 | +instructions. Additionally, it should include |
| 22 | + |
| 23 | + * the pandoc version, |
| 24 | + * the exact command line used, |
| 25 | + * the exact input used, |
| 26 | + * the output received, and |
| 27 | + * the output you expected instead. |
| 28 | + |
| 29 | +This will allow us to help you more quickly. |
| 30 | + |
| 31 | +Pull requests |
| 32 | +------------- |
| 33 | + |
| 34 | +Whether a small patch or a full new filters, we love getting pull |
| 35 | +requests. Consistency is important, especially for a project with |
| 36 | +multiple parts written by many contributors. That's why PRs should |
| 37 | +follow the filter structure outlined below. |
| 38 | + |
| 39 | +Filter Structure |
| 40 | +---------------- |
| 41 | + |
| 42 | +The filters come with these components: |
| 43 | + |
| 44 | +- `README.md` describing the filter; if the filter depends on |
| 45 | + additional programs, the document should list those requirements |
| 46 | + and describe how they can be installed. |
| 47 | + |
| 48 | + Please keep in mind that a key design goal of Markdown was |
| 49 | + readability. The README should be pleasant to read even as plain |
| 50 | + text. This includes keeping lines below 80 chars or, better yet, |
| 51 | + below 66 chars. |
| 52 | + |
| 53 | +- The main Lua filter script; besides the code, it should also |
| 54 | + contain a small header with author, copyright, and licensing |
| 55 | + information. All filters must be licensed under the MIT license. |
| 56 | + |
| 57 | + Lua code should follow the HsLua [Lua style guide]. The |
| 58 | + tl;dr is: use snake_case for most names and keep lines below 80 |
| 59 | + chars. |
| 60 | + |
| 61 | +- `Makefile` to run the tests. The only hard requirement is the |
| 62 | + existence of a `.PHONY` target named `test` which can be used to |
| 63 | + test correctness. |
| 64 | + |
| 65 | +- `sample.md` or a similar file demonstrating how the filter can |
| 66 | + be used. The sample file doubles as test input. |
| 67 | + |
| 68 | +- A file containing the expected output when using the filter on |
| 69 | + the sample input. Multiple such files can be provided if |
| 70 | + different filter configurations are to be tested. |
| 71 | + |
| 72 | +All components should be bundled in a single directory. |
| 73 | + |
| 74 | +Text and source files should always be terminated by a final |
| 75 | +newline character. The repository comes with a `.editorconfig` |
| 76 | +file which helps to adhere to this and similar conventions. Please |
| 77 | +consider installing [editorconfig](https://editorconfig.org) if |
| 78 | +you editor supports it. |
| 79 | + |
| 80 | +### Configuration |
| 81 | + |
| 82 | +Filters are expected to be readily usable by a wide range of |
| 83 | +users. It should not be necessary to edit any source files, so it |
| 84 | +often makes sense to keep a filter configurable. |
| 85 | + |
| 86 | +There are two main methods to configure a filter: environment |
| 87 | +variables and special metadata values. The `diagram-generator` |
| 88 | +filter supports both and can serve as a good reference. |
| 89 | + |
| 90 | +Tests |
| 91 | +----- |
| 92 | + |
| 93 | +We currently test filters under two aspects on different CI |
| 94 | +systems: |
| 95 | + |
| 96 | +- *Travis CI*: filters are tested against the latest pandoc |
| 97 | + version as available from pandoc's download page. The build is |
| 98 | + configured via `.travis.yml`. |
| 99 | +- *Circle CI*: tests are run in the latest pandoc/ubuntu Docker |
| 100 | + image. The config is in `.circleci/config.yml`. |
| 101 | + |
| 102 | +Both systems contain all software necessary to run the tests. Some |
| 103 | +filters require additional software to be installed. Please make |
| 104 | +sure that all requirements are satisfied in both build |
| 105 | +environments and that the builds finish successfully. |
| 106 | + |
| 107 | +Commits |
| 108 | +------- |
| 109 | + |
| 110 | +Please follow the usual guidelines for git commits: keep commits |
| 111 | +atomic, self-contained, and add a brief but clear commit message. |
| 112 | +This [guide](https://chris.beams.io/posts/git-commit/) by Chris |
| 113 | +Beams is a good resource if you'd like to learn more. |
| 114 | + |
| 115 | +However, don't fret over this too much. You can also just |
| 116 | +accumulate commits without much thought for this rule. We can |
| 117 | +squash all commits in a PR into a single commit upon merging. But |
| 118 | +we still appreciate it if we don't have to rewrite the commit |
| 119 | +message. |
| 120 | + |
| 121 | + |
| 122 | +[issue tracker]: https://github.com/pandoc/lua-filters/issues |
| 123 | +[Lua style guide]: https://github.com/hslua/lua-style-guide |
0 commit comments