Skip to content

Commit e1cf9ba

Browse files
authored
Docs: update visual diff docs (#12453)
Extracted from #12276
1 parent 2d91beb commit e1cf9ba

File tree

2 files changed

+80
-27
lines changed

2 files changed

+80
-27
lines changed
62.9 KB
Loading

docs/user/visual-diff.rst

Lines changed: 80 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,99 @@
11
Visual diff
22
===========
33

4-
Visual diff allows you to see a visual :term:`diff` on a documentation page,
5-
showing what has changed between the ``latest`` version and the active :doc:`pull request </pull-requests>`.
4+
Get a list of documentation files that changed between the :doc:`pull request </pull-requests>` and the latest version of the documentation,
5+
and see their differences highlighted visually on the documentation pages.
66

7-
Visual diff allows you to quickly review changes visually,
8-
and focus your review on what has changed in the current page.
7+
While seeing changes in source files is helpful,
8+
it can be difficult to understand how those changes will look in the rendered documentation,
9+
or their impact on the documentation as a whole.
10+
Read the Docs makes it easy to see the changes in the rendered documentation.
911

10-
Using Visual diff
11-
-----------------
12+
Show diff menu in preview
13+
-------------------------
1214

13-
Visual diff is enabled by default and is only available on pull request builds.
14-
It works by comparing the current page with the default version of the documentation (e.g. where `/` redirects to).
15+
To enable or disable this feature for your project:
1516

16-
When Visual diff is enabled,
17-
a new UI element appears at the top right of the page showing a dropdown selector containing all the files that have changed in that pull request build.
17+
#. Go the :guilabel:`Settings` tab of your project.
18+
#. Click on :guilabel:`Addons`, and click on :guilabel:`Visual diff`.
19+
#. Check or uncheck the :guilabel:`Enable visual diff` option.
20+
#. Click on :guilabel:`Save`.
21+
22+
When enabled, a new UI element appears at the top right of the page showing a dropdown selector containing all the files that have changed in that pull request build.
1823

1924
.. figure:: /img/screenshot-viz-diff-ui.png
2025
:width: 80%
2126

2227
You can select any of those files from the dropdown to jump directly into that page.
23-
Once there, you can toggle Visual Diff on and off by pressing the :guilabel:`Show diff` link from the UI element, or pressing the `d` key if you have hotkeys enabled.
28+
Once there, you can toggle Visual Diff on and off by pressing the :guilabel:`Show diff` link from the UI element, or pressing the ``d`` key if you have hotkeys enabled.
29+
30+
Visual diff shows all the sections that have changed, highlighting their differences with red/green background colors.
31+
You can jump between each of these chunks by clinking on the up/down arrows.
32+
33+
Show build overview in pull requests
34+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
35+
36+
.. note::
37+
38+
This feature is only available for projects connected to a :ref:`reference/git-integration:GitHub App`.
39+
40+
To enable or disable this feature for your project:
41+
42+
#. Go the :guilabel:`Settings` tab of your project.
43+
#. Click on :guilabel:`Pull request builds`.
44+
#. Check or uncheck the :guilabel:`Show build overview in a comment` option.
45+
#. Click on :guilabel:`Update`.
46+
47+
When enabled, a comment is added to the pull request when changes are detected between the pull request and the latest version of the documentation.
48+
49+
.. figure:: /img/build-overview-comment.png
50+
51+
General settings
52+
----------------
53+
54+
Ignored files
55+
~~~~~~~~~~~~~
56+
57+
You can configure a list of files or patterns to be ignored when listing the files that changed in the pull request.
58+
This is useful when you have files that have a date in them,
59+
or listing/archive files that show changes without content changes in those files.
60+
61+
#. Go the :guilabel:`Settings` tab of your project.
62+
#. Click on :guilabel:`Addons`, and click on :guilabel:`File tree diff`.
63+
#. In the :guilabel:`Ignored files` field, add one or more patterns to ignore, one per line.
64+
#. Click on :guilabel:`Save`.
65+
66+
Patterns are matched against the relative paths of the HTML files produced by the build,
67+
you should try to match ``index.html``, not ``docs/index.rst``, nor ``/en/latest/index.html``.
68+
Patterns can include one or more of the following special characters:
2469

25-
Visual diff will show all the sections that have changed and their differences highlighted with red/green background colors.
26-
Then you can jump between each of these chunks by clinking on the up/down arrows.
70+
- ``*`` matches everything, including slashes.
71+
- ``?`` matches any single character.
72+
- ``[seq]`` matches any character in ``seq``.
2773

28-
Configuring Visual Diff
29-
-----------------------
74+
Base version
75+
~~~~~~~~~~~~
3076

31-
All the available configuration for the visual diff addon can be found under :guilabel:`Settings > Addons > Visual diff` in the :term:`dashboard`.
32-
You can choose to disable/enable the `Visual diff` feature on a per project basis.
33-
Visual diff can also ignore files by specifying these files under `File tree diff`, regex supported.
77+
The base version is the version of the documentation that is used to compare against the pull request.
78+
By default, this is the ``latest`` version of the documentation.
79+
This is useful if your ``latest`` version doesn't point the default branch of your repository.
3480

35-
Troubleshooting Visual diff
36-
---------------------------
81+
.. note::
3782

38-
Visual diff only works when we detect changes on the page,
39-
so ensure you are on a page that has changed in the current pull request.
83+
This option can be changed by contacting :doc:`/support`.
4084

41-
There are also some known issues that currently don't display properly.
42-
We are working to improve the UX, but so far we've found the following issues:
85+
Limitations and known issues
86+
----------------------------
4387

44-
* **Tables** are shown to have changes when they may not have changed. This is due to subtle variations in how HTML tables are rendered, and will be fixed in a future version.
45-
* **Invisible changes** sometimes are marked as diff due than the underlying HTML changing, but there is no visual change. This could happen if the URL of a link changed, for example.
46-
* **Chunks background is incorrect** when we are unable to detect the correct main parent element for the chunk.
88+
- The diff considers HTML files only.
89+
- The diff is done between the files from the latest successful build of the pull request and the default base version (latest by default).
90+
If your pull request gets out of sync with its base branch, the diff may not be accurate, and may show unrelated files and sections as changed.
91+
- The diff is done by comparing the "main content" of the HTML files.
92+
This means that some changes outside the main content, like header or footer, may not be detected.
93+
This is done to avoid showing changes that are not relevant to the documentation content itself.
94+
Like all pages being marked as changed because of a date or commit hash being updated in the footer.
95+
- Invisible changes. Some sections may be highlighted as changed, even when they haven't actually visually changed.
96+
This can happen when the underlying HTML changes without a corresponding visual change, for example, if a link's URL is updated
97+
- Tables may be shown to have changes when they have not actually changed.
98+
This is due to subtle variations in how HTML tables are rendered, and will be fixed in a future version.
99+
- The background of diff chunks may be incorrect when we are unable to detect the correct main parent element for the chunk.

0 commit comments

Comments
 (0)