| 1 |
======================== |
| 2 |
Contributing to Pygments |
| 3 |
======================== |
| 4 |
|
| 5 |
Thanks for your interest in contributing! Please read the following |
| 6 |
guidelines. |
| 7 |
|
| 8 |
|
| 9 |
Licensing |
| 10 |
========= |
| 11 |
|
| 12 |
The code is distributed under the BSD 2-clause license. Contributors making pull |
| 13 |
requests must agree that they are able and willing to put their contributions |
| 14 |
under that license. |
| 15 |
|
| 16 |
|
| 17 |
General contribution checklist |
| 18 |
============================== |
| 19 |
|
| 20 |
* Check the documentation for how to write |
| 21 |
:doc:`a new lexer <lexerdevelopment>`, |
| 22 |
:doc:`a new formatter <formatterdevelopment>`, |
| 23 |
:doc:`a new style <styledevelopment>` or |
| 24 |
:doc:`a new filter <filterdevelopment>`. |
| 25 |
If adding a lexer, please make sure you have |
| 26 |
read :ref:`lexer-pitfalls`. |
| 27 |
|
| 28 |
* Run the test suite with ``tox``, and ensure it passes. |
| 29 |
|
| 30 |
* Make sure to add a test for your new functionality, and where applicable, |
| 31 |
write documentation. |
| 32 |
|
| 33 |
* Use the standard importing convention: ``from token import Punctuation`` |
| 34 |
|
| 35 |
Goals & non-goals of Pygments |
| 36 |
============================= |
| 37 |
|
| 38 |
Python support |
| 39 |
-------------- |
| 40 |
|
| 41 |
Pygments supports all supported Python versions as per the `Python |
| 42 |
Developer's Guide`_. Additionally, the default Python |
| 43 |
version of the latest stable version of RHEL, Ubuntu LTS, and Debian |
| 44 |
are supported, even if they're officially EOL. Supporting other |
| 45 |
end-of-life versions is a non-goal of Pygments. |
| 46 |
|
| 47 |
.. _Python Developer's Guide: https://devguide.python.org/versions/ |
| 48 |
|
| 49 |
|
| 50 |
Validation |
| 51 |
---------- |
| 52 |
|
| 53 |
Pygments does not attempt to validate the input. Accepting code that |
| 54 |
is not legal for a given language is acceptable if it simplifies the |
| 55 |
codebase and does not result in surprising behavior. For instance, in |
| 56 |
C89, accepting `//` based comments would be fine because de-facto all |
| 57 |
compilers supported it, and having a separate lexer for it would not |
| 58 |
be worth it. |
| 59 |
|
| 60 |
Language support |
| 61 |
---------------- |
| 62 |
|
| 63 |
While we strive for the broadest language support possible, we can't support |
| 64 |
every programming language on the planet. Our minimum bar is fairly low, but to |
| 65 |
avoid pet projects and other one-off languages, we expect any language that is |
| 66 |
proposed for inclusion to have a reasonably sized community around it. If you |
| 67 |
need a syntax highlighter for your in-house programming language or the brand |
| 68 |
new language project you kicked off, consider writing a :doc:`plugin <plugins>` |
| 69 |
until it gains enough popularity. |