# Contributing to HTML Tidy So you want to contribute to Tidy? Fantastic! Here's a brief overview on how best to do so. ### Support request If you are having trouble running console `Tidy`, or using the `LibTidy` API in your own project, then maybe the best places to get help is either via a comment in [Tidy Issues](https://github.com/htacg/tidy-html5/issues), or on the [Tidy Mail Archive](https://lists.w3.org/Archives/Public/html-tidy/) list. In either place please start with a short subject to describe the issue. If it involves running Tidy on an html file, or if it’s an API question, make sure to include: - the version: `$ tidy -v` - what was the configuration used - a small sample input - the output - the _expected_ output expected - some sample code (if an API question). These data will make replication of your issue much simpler for us. If you do add sample HTML input, then it can also be very helpful if that sample **passes** the W3C [validator](https://validator.w3.org/#validate_by_upload). Tidy attempts to follow all current W3C standards. If you are able to build tidy from [source](https://github.com/htacg/tidy-html5) (requires [CMake](https://cmake.org/download/)), and you can find the problem in the source code, then read on about how you can create a Pull Request (“PR”) to share your code and ideas. ### What to change Here are some examples of things you might want to make a PR for: - New features - Bug fixes - Inefficient blocks of code - Memory problems - Language translations If you have a more deeply-rooted problem with how the program is built or some of the stylistic decisions made in the code, it is best to [create an issue](https://github.com/htacg/tidy-html5/issues/new) before putting the effort into a pull request. The same goes for new features - it might be best to check the project's direction, existing pull requests, and currently open and closed issues first. Concerning the “Tidy Code Style,” checkout [CODESTYLE.md](CODESTYLE.md), but looking at existing code is the best way to get a good feel for the patterns we use. ### Using Git appropriately 1. Fork tidy to your own github account. Use top right `Fork` icon. 2. Optional: Generate a SSH Key, and add it to your `https://github.com/` settings, SSH and GPG keys 3. Clone your own fork - `$ git clone git@github.com:/tidy-html5.git tidy-fork` Or using `https`. 4. Create a branch - `$ cd tidy-fork; $ git checkout -b ` 5. Edit, and commit your changes to this `branch` of your fork. 6. Test your changes, and if appropriate run [regression](https://github.com/htacg/tidy-html5-tests/blob/next/README/RUNTESTS.md) tests. 7. Publish the branch - `$ git push -u origin `, `$ git rebase next`, fix conflict, if any, and `$ git push`, for each branch. It is not fun to keep multiple `branches` fully up-to-date with an active `upstream`... Of course, the **regression** tests, 6., are really only if you have made `code` changes, but it is a good habit to get into. As can be seen the `tests` are in a **separate** repo, so you must also clone that. This is best done in the same `root` folder where where you cloned `tidy-html5`. ``` $ git clone git@github.com:htacg/tidy-html5-tests.git $ cd tidy-html5-tests/tools-sh $ ./testall.sh ../../tidy-html5/build/cmake/tidy $ diff -u ../cases/testbase-expects ../cases/testbase-results ``` If the `testall.sh` shows a different exit value, or there are differences between the `expects` and `results` these **must** be studied, checked very carefully. There may be cases where the **new** `results` are correct, in which case a simultaneous PR for the tests must be created to match your source PR. ### Help Tidy Get Better It goes without saying **all help is appreciated**. We need to work together to make Tidy better!