Skip to content

Commit cd2d434

Browse files
authored
Un-deprecate array-style custom fragments (#438)
1 parent 9f3d62b commit cd2d434

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

docs/configuration.rst

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ Custom fragment types
3636
``towncrier`` allows defining custom fragment types.
3737
Custom fragment types will be used instead ``towncrier`` default ones, they are not combined.
3838

39+
There are two ways to add custom fragment types.
40+
41+
42+
Defining Custom Fragment Types With a TOML Mapping
43+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
44+
3945
Users can configure each of their own custom fragment types by adding tables to
4046
the pyproject.toml named ``[tool.towncrier.fragment.<a custom fragment type>]``.
4147

@@ -59,6 +65,44 @@ For example, if you want your custom fragment types to be ``["feat", "fix", "cho
5965
showcontent = false
6066
6167
68+
.. warning::
69+
70+
Since TOML mappings aren't ordered, the sections are always rendered alphabetically.
71+
72+
73+
Defining Custom Fragment Types With an Array of TOML Tables
74+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
75+
76+
Users can create their own custom fragment types by adding an array of
77+
tables to the pyproject.toml named ``[[tool.towncrier.type]]``.
78+
79+
If you use this way to configure custom fragment types, please note that ``fragment_types`` must be empty or not provided.
80+
81+
Each custom type (``[[tool.towncrier.type]]``) has the following
82+
mandatory keys:
83+
84+
* ``directory``: The type / category of the fragment.
85+
* ``name``: The description of the fragment type, as it must be included
86+
in the news file.
87+
* ``showcontent``: Whether if the fragment contents should be included in the
88+
news file.
89+
90+
For example:
91+
92+
.. code-block:: toml
93+
94+
[tool.towncrier]
95+
[[tool.towncrier.type]]
96+
directory = "deprecation"
97+
name = "Deprecations"
98+
showcontent = true
99+
100+
[[tool.towncrier.type]]
101+
directory = "chore"
102+
name = "Other Tasks"
103+
showcontent = false
104+
105+
62106
All Options
63107
-----------
64108

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Defining custom fragments using a TOML array is not deprecated anymore.

0 commit comments

Comments
 (0)