Debian Codegraph @

docs/reference/example.md

raw
1 ---
2 jupytext:
3 cell_metadata_filter: -all
4 formats: md:myst
5 text_representation:
6 extension: .md
7 format_name: myst
8 format_version: 0.12
9 jupytext_version: 1.6.0
10 kernelspec:
11 display_name: Python 3
12 language: python
13 name: python3
14 ---
15
16 # Reference examples
17
18 This is a page to show off some examples of this tool in use, and as a reference to test visual changes over time.
19
20 ## Code Cells
21
22
23
24 To make sure that the images / svg still works!
25
26 ```python
27 e = mc^2
28 ```
29
30 Copytext with line numbers!
31
32 ```{code-cell} python
33 :linenos:
34
35 print(1)
36 print(2)
37 print(3)
38 print(4)
39 ```
40
41 Copy text with literalincludes!
42
43 ```{literalinclude} literal.py
44 :linenos:
45 :language: python
46 ```
47
48 ## Tables
49
50 ````{list-table}
51 - * ```
52 cell one
53 ```
54 * ```
55 cell two
56 ```
57 - * ```
58 cell three
59 ```
60 * ```
61 cell four
62 ```
63 ````
64 ## MyST Notebook Cells
65
66 Sphinx Copybutton works with [MyST Notebooks](https://myst-nb.readthedocs.io) as well. See below for the code inputs and outputs:
67
68 ### Regular cells
69
70 A regular cell:
71
72 ```python
73 print("hi")
74 ```
75
76 ### Notebook cells
77
78 Next we'll demo notebook cells to see if these are rendered correctly.
79
80 ```{code-cell}
81 print("hi")
82 ```
83
84 ## Rough edges
85
86 This section displays UI behavior that we know is incorrect.
87 Consider this a wish-list for contributions if somebody knows how to fix these issues!
88
89 ### Float-right content doesn't move the copy button
90
91 If there is content floated to the right, the code block will shrink, but not the copy button.
92 For example. hover over the code block below, the copy button will float to the right, over the sidebar.
93
94 ```{sidebar} Placeholder sidebar
95 This is a placeholder sidebar text to display!
96 It will push the code block to the left, but not the copy button
97 ```
98
99 ```python
100 print("hi")
101 ```