Debian Codegraph @

docs/get_started.md

raw
1 # Getting Started
2
3 ```{article-info}
4 :avatar: images/ebp-logo.png
5 :avatar-link: https://executablebooks.org
6 :author: "[Chris Sewell](https://github.com/chrisjsewell)"
7 :date: "{sub-ref}`today`"
8 :read-time: "1 min read"
9 :class-avatar: sd-animate-grow50-rot20
10 ```
11
12 ## Usage
13
14 Simply pip install `sphinx-design` and add the extension to your `conf.py`:
15
16 ```python
17 extensions = ["sphinx_design"]
18 ```
19
20 For using with [MyST Parser](https://github.com/executablebooks/myst-parser), for Markdown documentation, it is recommended to use the `colon_fence` syntax extension:
21
22 ```python
23 extensions = ["myst_parser", "sphinx_design"]
24 myst_enable_extensions = ["colon_fence"]
25 ```
26
27 ## Configuration
28
29 To hide the the title header of a page, add to the top of the page:
30
31 ::::{tab-set}
32 :::{tab-item} MyST Markdown
33 ```markdown
34 ---
35 sd_hide_title: true
36 ---
37 ```
38 :::
39 :::{tab-item} RestructuredText
40 ```rst
41 :sd_hide_title:
42 ```
43 :::
44 ::::
45
46 ### Creating custom directives
47
48 :::{versionadded} 0.6.0
49 :::
50
51 You can use the `sd_custom_directives` configuration option in your `conf.py` to add custom directives, with default option values:
52
53 ```python
54 sd_custom_directives = {
55 "dropdown-syntax": {
56 "inherit": "dropdown",
57 "argument": "Syntax",
58 "options": {
59 "color": "primary",
60 "icon": "code",
61 },
62 }
63 }
64 ```
65
66 The key is the new directive name to add, and the value is a dictionary with the following keys:
67
68 - `inherit`: The directive to inherit from (e.g. `dropdown`)
69 - `argument`: The default argument (optional, only for directives that take a single argument)
70 - `options`: A dictionary of default options for the directive (optional)
71
72 ## Supported browsers
73
74 - Chrome >= 60
75 - Firefox >= 60
76 - Firefox ESR
77 - iOS >= 12
78 - Safari >= 12
79 - Explorer >= 12
80
81 (Mirrors: <https://github.com/twbs/bootstrap/blob/v5.0.2/.browserslistrc>)
82
83 ## Migrating from sphinx-panels
84
85 This package arose as an iteration on [sphinx-panels](https://github.com/executablebooks/sphinx-panels), with the intention to make it more flexible, easier to use, and minimise CSS clashes wth sphinx themes.
86
87 Notable changes:
88
89 ### Reduce direct use of CSS classes
90
91 These are replaced by the use of directive options, which are:
92
93 - Easier to understand
94 - Easier to validate
95 - Easier to work with non-HTML outputs
96 - Easier to improve/refactor
97
98 ### `panel` directive replaced
99
100 The `panel` directive is replaced by the use of the top-level `grid` directive,
101 then using `grid-item-card` directive children, rather than delimiting cards by `---`.
102
103 If no card is needed, then the `grid-item` directive can be used instead and `card` can be also used independently of grids.
104
105 Approximately, `.. panels::` is equivalent to `.. grid:: 1 2 2 2` with option `:gutter: 2`.
106
107 ### `tabbed` directive replaced
108
109 The `tabbed` directive is replaced by the use of the top-level `tab-set` directive,
110 then using `tab-item` directive children.
111
112 The `:sync:` option allows to synchronize tab selection across sets.
113
114 The `tab-set-code` directive provides a shorthand for synced code examples.
115
116 ### `link-button` directive replaced
117
118 The `link-button` directive is replaced by the use of `button-ref`/`button-link`.
119
120 Directive options have also been added to replace the use of classes:
121
122 - `stretched-link` -> `:click-parent:`
123 - `btn-block` -> `:expand:`
124
125 ### `octicon` icon role
126
127 The default SVGs produced are now sized relative to the surrounding text (i.e. using `1em`).
128 The syntax for specifying a custom size and adding classes is also changed.
129
130 This is similar for favicon icons, where the `,` delimiter is also replaced by `;`, e.g. ``:fa:`name,class` `` -> ``:fa:`name;class` ``.
131
132 ### Improved CSS
133
134 Updated Bootstrap CSS from v4 -> v5,
135 which in particular allows top-level grid to define both column numbers and gutter sizes.
136
137 All CSS classes are prefixed with `sd-` (no clash with other theme/extension CSS)
138
139 All colors use CSS variables (customisable)