crate-docs-theme icon indicating copy to clipboard operation
crate-docs-theme copied to clipboard

Wishlist: Add basic extension to aggregate change log pages

Open amotl opened this issue 2 years ago • 3 comments

About

In order to evaluate alternative views for the release notes published at ^1, and maintained at ^2, we may want to bring in some ideas from ^3, or different ones, which closer match this use case.

Details

A sensible thing to start with, would be to aggreate individual pages into "one page per release" views. /cc @proddata

amotl avatar Jul 31 '23 18:07 amotl

Exercise I

Just using vanilla .. include:: directives to re-bundle pages does not work well.

  • https://github.com/sphinx-doc/sphinx/issues/10744#issuecomment-1658927670
Warning, treated as error:
../docs/appendices/release-notes/5.0.0.rst:139:Duplicate target name, cannot be used as a unique reference: "breaking changes".

amotl avatar Aug 03 '23 08:08 amotl

Exercise II

Thoughts

At https://github.com/sphinx-doc/sphinx/issues/10744#issuecomment-1658988192, we discovered that the MyST include directive offers a heading-offset directive option, which can

offset all the heading levels [of the included page] by a positive integer number.

-- https://github.com/executablebooks/MyST-Parser/issues/262#issuecomment-1449474949

Based on that, @felixvd suggested at https://github.com/sphinx-doc/sphinx/issues/10744#issuecomment-1659350439 to place each include under its own header, and using the heading-offset directive option as intended.

Attempt 1

In 5.x.x.rst, we said:

#############
Release 5.0.0
#############

.. include:: 5.0.0.rst

However, it does not work, because the included page includes reference anchors, and parsing them twice makes Sphinx croak.

Warning, treated as error:
/Users/amo/dev/crate/sources/crate/docs/appendices/release-notes/5.0.0.rst:5:duplicate label version_5.0.0, other instance in /Users/amo/dev/crate/sources/crate/docs/appendices/release-notes/5.0.0.rst

Attempt 2

Then, we tried to use MyST, as @felixvd suggested. In 5.x.x.md, we said:

# Release 5.0.0

```{include} 5.0.0.rst
:heading-offset: 1
```

Unfortunately, files written in MyST Markdown are apparently not able to include reStructuredText files properly, so the result looks like that. Maybe there are corresponding options to make this detail work, maybe not.

image

amotl avatar Aug 03 '23 08:08 amotl

Attempt 3

Idea

Using the :start-line: option of the .. include:: directive could be a potential quick solution/workaround, in order to skip the reference and heading at the top of the included page.

.. include:: member.rst
    :start-line: 5

-- https://docutils.sourceforge.io/docs/ref/rst/directives.html#including-an-external-document-fragment

Outcome

It does not work well, because within each page, just using

See `Breaking Changes`_.

is actually the culprit here, which causes this warning.

Warning, treated as error:
../docs/appendices/release-notes/5.0.0.rst:136:Duplicate target name, cannot be used as a unique reference: "breaking changes".

amotl avatar Aug 06 '23 09:08 amotl