Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Un-deprecate array-style custom fragments #438

Merged
merged 1 commit into from
Sep 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions docs/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ Custom fragment types
``towncrier`` allows defining custom fragment types.
Custom fragment types will be used instead ``towncrier`` default ones, they are not combined.

There are two ways to add custom fragment types.


Defining Custom Fragment Types With a TOML Mapping
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Users can configure each of their own custom fragment types by adding tables to
the pyproject.toml named ``[tool.towncrier.fragment.<a custom fragment type>]``.

Expand All @@ -59,6 +65,44 @@ For example, if you want your custom fragment types to be ``["feat", "fix", "cho
showcontent = false


.. warning::

Since TOML mappings aren't ordered, the sections are always rendered alphabetically.
hynek marked this conversation as resolved.
Show resolved Hide resolved


Defining Custom Fragment Types With an Array of TOML Tables
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Users can create their own custom fragment types by adding an array of
tables to the pyproject.toml named ``[[tool.towncrier.type]]``.

If you use this way to configure custom fragment types, please note that ``fragment_types`` must be empty or not provided.

Each custom type (``[[tool.towncrier.type]]``) has the following
mandatory keys:

* ``directory``: The type / category of the fragment.
* ``name``: The description of the fragment type, as it must be included
in the news file.
* ``showcontent``: Whether if the fragment contents should be included in the
news file.

For example:

.. code-block:: toml

[tool.towncrier]
[[tool.towncrier.type]]
directory = "deprecation"
name = "Deprecations"
showcontent = true

[[tool.towncrier.type]]
directory = "chore"
name = "Other Tasks"
showcontent = false


All Options
-----------

Expand Down
1 change: 1 addition & 0 deletions src/towncrier/newsfragments/438.doc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Defining custom fragments using a TOML array is not deprecated anymore.