Skip to content

Commit 8aaa653

Browse files
committed
Add use example to README
1 parent 1226862 commit 8aaa653

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

README.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44

55
This repository provides the Python package `openqasm-sphinx`, which provides a [Sphinx extension](https://www.sphinx-doc.org) for documentation OpenQASM 2 and 3 code.
66

7+
The documentation is hosted at https://openqasm.com/openqasm-sphinx.
78

8-
## Installation and use
9+
10+
## Installation
911

1012
Install the latest release of `openqasm-sphinx` package from pip:
1113

@@ -15,6 +17,8 @@ pip install openqasm-sphinx
1517

1618
This will automatically install all the dependencies as well (Sphinx, for example) if they are not already installed.
1719

20+
## Use
21+
1822
To activate the extension add `openqasm_sphinx` to your `extensions` list in your Sphinx `conf.py` file, such as:
1923

2024
```python
@@ -29,6 +33,25 @@ extensions = [
2933

3034
There is no need to import the extension; Sphinx will handle this automatically.
3135

36+
Document a gate by doing:
37+
38+
```rst
39+
40+
.. oq:gate:: my_gate(θ) a, b
41+
42+
This is my gate.
43+
```
44+
45+
and later insert a cross-reference to it in inline text with:
46+
47+
```rst
48+
For more information, see :oq:gate:`my_gate`.
49+
```
50+
51+
If you are set `primary_domain = "oq"` in your Sphinx configuration, you can drop the `oq` prefixes.
52+
53+
For more complete usage information, see [the rendered documentation](https://openqasm.com/openqasm-sphinx).
54+
3255

3356
## Developing
3457

0 commit comments

Comments
 (0)