File: example.md

package info (click to toggle)
sphinx-copybutton 0.5.2-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 508 kB
  • sloc: javascript: 321; python: 192; makefile: 21
file content (101 lines) | stat: -rw-r--r-- 1,774 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
---
jupytext:
  cell_metadata_filter: -all
  formats: md:myst
  text_representation:
    extension: .md
    format_name: myst
    format_version: 0.12
    jupytext_version: 1.6.0
kernelspec:
  display_name: Python 3
  language: python
  name: python3
---

# Reference examples

This is a page to show off some examples of this tool in use, and as a reference to test visual changes over time.

## Code Cells



To make sure that the images / svg still works!

```python
e = mc^2
```

Copytext with line numbers!

```{code-cell} python
:linenos:

print(1)
print(2)
print(3)
print(4)
```

Copy text with literalincludes!

```{literalinclude} literal.py
:linenos:
:language: python
```

## Tables

````{list-table}
- * ```
    cell one
    ```
  * ```
    cell two
    ```
- * ```
    cell three
    ```
  * ```
    cell four
    ```
````
## MyST Notebook Cells

Sphinx Copybutton works with [MyST Notebooks](https://myst-nb.readthedocs.io) as well. See below for the code inputs and outputs:

### Regular cells

A regular cell:

```python
print("hi")
```

### Notebook cells

Next we'll demo notebook cells to see if these are rendered correctly.

```{code-cell}
print("hi")
```

## Rough edges

This section displays UI behavior that we know is incorrect.
Consider this a wish-list for contributions if somebody knows how to fix these issues!

### Float-right content doesn't move the copy button

If there is content floated to the right, the code block will shrink, but not the copy button.
For example. hover over the code block below, the copy button will float to the right, over the sidebar.

```{sidebar} Placeholder sidebar
This is a placeholder sidebar text to display!
It will push the code block to the left, but not the copy button
```

```python
print("hi")
```