@@ -36,6 +36,12 @@ Custom fragment types
3636``towncrier `` allows defining custom fragment types.
3737Custom 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+
3945Users can configure each of their own custom fragment types by adding tables to
4046the 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
0 commit comments