Debian Codegraph @

docs/community/topics/bootstrap.rst

raw
1 Upgrade to bootstrap 5
2 ======================
3
4 Since *v0.13*, ``pydata-sphinx-theme`` has moved from Bootstrap 4 to `Bootstrap 5 <https://getbootstrap.com/docs/5.1/getting-started/introduction/>`_.
5 This documentation will guide you through the changes we made and how you could follow the same steps in your existing documentation.
6
7 Dropping **JQuery**
8 -------------------
9
10 Bootstrap Dropped its **JQuery** dependency and rewrote plugins to be in regular JavaScript.
11 Sphinx *v6* will do the same (https://github.com/sphinx-doc/sphinx/issues/10070).
12 As a consequence, we also rewrote all our javascript to only use vanilla **JavaScript**.
13 Any documentation relying on **JQuery** in their ``custom.js`` files will need to rewrite or specifically import **JQuery**.
14
15 Breaking changes
16 ----------------
17
18 .. important::
19
20 Relevant for those using a ``custom.css`` and/or a ``custom.js`` file!
21
22 Bootstrap changed several CSS classes, so if you wrote custom rules of JS logic that depended on them, it may have changed.
23
24 All the changes from *v4* to *v5* are `listed in their documentation <https://getbootstrap.com/docs/5.0/migration/>`_.
25 Below list the ones that had consequences on ``pydata-sphinx-theme`` components.
26
27 Sass
28 ^^^^
29
30 - Media query mixins parameters have changed for a more logical approach.
31
32 - ``media-breakpoint-down()`` uses the breakpoint itself instead of the next breakpoint (e.g., ``media-breakpoint-down(lg)`` instead of ``media-breakpoint-down(md)`` targets viewports smaller than lg).
33 - Similarly, the second parameter in ``media-breakpoint-between()`` also uses the breakpoint itself instead of the next breakpoint (e.g., ``media-between(sm, lg)`` instead of ``media-breakpoint-between(sm, md)`` targets viewports between sm and lg).
34
35 - ``box-shadow`` mixins now allow ``null`` values and drop ``none`` from multiple arguments.
36
37 Content, Reboot, etc
38 ^^^^^^^^^^^^^^^^^^^^
39
40 - Nested tables do not inherit styles anymore.
41
42 - ``.thead-light`` and ``.thead-dark`` are dropped in favor of the ``.table-*`` variant classes which can be used for all table elements (``thead``, ``tbody``, ``tfoot``, ``tr``, ``th`` and ``td``).
43
44 - Dropped ``.text-justify`` class. See https://github.com/twbs/bootstrap/pull/29793
45
46 Utilities
47 ^^^^^^^^^
48
49 - Renamed several utilities to use logical property names instead of directional names with the addition of RTL support:
50
51 - Renamed ``.left-*`` and ``.right-*`` to ``.start-*`` and ``.end-*``.
52 - Renamed ``.float-left`` and ``.float-right`` to ``.float-start`` and ``.float-end``.
53 - Renamed ``.border-left`` and ``.border-right`` to ``.border-start`` and ``.border-end``.
54 - Renamed ``.rounded-left`` and ``.rounded-right`` to ``.rounded-start`` and ``.rounded-end``.
55 - Renamed ``.ml-*`` and ``.mr-*`` to ``.ms-*`` and ``.me-*``.
56 - Renamed ``.pl-*`` and ``.pr-*`` to ``.ps-*`` and ``.pe-*``.
57 - Renamed ``.text-left`` and ``.text-right`` to ``.text-start`` and ``.text-end``.
58
59 JavaScript
60 ^^^^^^^^^^
61
62 - Data attributes for all JavaScript plugins are now namespaced to help distinguish Bootstrap functionality from third parties and your code. For example, we use ``data-bs-toggle`` instead of ``data-toggle``.
63 - Bootstrap's `Programmatic API <https://getbootstrap.com/docs/5.0/getting-started/javascript/#programmatic-api>`_, ``bootstrap``, is also available. This API can be useful for initializing opt-in components that are not initialized by default such as `Popovers <https://getbootstrap.com/docs/5.0/components/popovers/#overview>`_.