@@ -256,3 +256,91 @@ main ``index.rst`` file and the ``learning.rst`` file in its "Getting started" s
256256 To use this feature, you must have the `quarto <https://quarto.org/> ` package installed. To create thumbnails of generated PDF files,
257257 the theme is using `pdf2image `. So you should have the ``poppler `` package installed in your system.
258258 For more information, see the `pdf2image documentation <https://pypi.org/project/pdf2image/ >`_.
259+
260+ What's new section
261+ ------------------
262+
263+ The "What's new" section is an option that allows you to highlight new features in your library
264+ for each minor version within the changelog file.
265+
266+ To get started, create a YAML file named ``whatsnew.yml `` in the ``doc/source `` directory. The
267+ YAML file should contain the following structure:
268+
269+ .. code-block :: yaml
270+
271+ fragments :
272+ - title : Feature title
273+ version : 0.2.0 # The version the feature is introduced
274+ content : |
275+ Feature description in RST format.
276+
277+ - title : Another feature title
278+ version : 0.1.2
279+ content : |
280+ Feature description in RST format.
281+
282+ The dropdown generation only supports the following RST formats in the "content" field:
283+
284+ - Bold: Use double asterisks to wrap the text.
285+ - Italics: Use single asterisks to wrap the text.
286+ - Code samples: Use single or double backticks to wrap the text.
287+ - Links: Use the following format to include links:
288+
289+ .. code-block :: rst
290+
291+ `link text <https://www.example.com>`_
292+
293+ - Code blocks: Use the following format to include code blocks:
294+
295+ .. code-block :: rst
296+
297+ .. code:: python
298+
299+ print("hello world")
300+
301+ If a format is used in the "content" field that does not fall into the categories above, it will not
302+ be rendered correctly.
303+
304+ To enable the "What's new" sections and sidebar in the changelog file, add the following dictionary
305+ to the ``html_theme_options `` dictionary:
306+
307+ .. code-block :: python
308+
309+ html_theme_options = (
310+ {
311+ " whatsnew" : {
312+ " whatsnew_file_path" : " changelog.d/whatsnew.yml" ,
313+ " changelog_file_path" : " changelog.rst" ,
314+ " sidebar_pages" : [" changelog" ],
315+ " sidebar_no_of_headers" : 3 , # Optional
316+ " sidebar_no_of_contents" : 3 , # Optional
317+ },
318+ },
319+ )
320+
321+ The dictionary contains the following keys:
322+
323+ - ``whatsnew_file_path ``: The path to the YAML file containing what's new content local to the
324+ ``doc/source `` directory. If not provided, the what's new section will not be generated.
325+ - ``changelog_file_path ``: The path to the changelog.rst file local to the ``doc/source ``
326+ directory. If not provided, the what's new section will not be generated.
327+ - ``sidebar_pages ``: List of names for the pages to include the what's new sidebar on. If not
328+ provided, the what's new sidebar is not displayed.
329+ - ``sidebar_no_of_headers ``: Number of minor version sections to display in the what's new sidebar.
330+ By default, it displays three version sections in the sidebar.
331+ - ``sidebar_no_of_contents ``: Number of what's new content to display under each minor version in the
332+ what's new sidebar. If not provided, it displays all dropdowns by default.
333+
334+ The following images show a sample "What's new" section and sidebar in the changelog file:
335+
336+ .. tab-set ::
337+
338+ .. tab-item :: What's new section
339+
340+ .. image :: ../_static/whatsnew_section.png
341+ :alt: What's new section
342+
343+ .. tab-item :: What's new sidebar
344+
345+ .. image :: ../_static/whatsnew_sidebar.png
346+ :alt: What's new sidebar
0 commit comments