Skip to content

Commit 7e608d5

Browse files
Demo notebook fixes (#1626)
This PR introduces a few fixes for processing the demo scripts into Jupyter Notebooks: - Replace direct references to thumbnail images with cloud URL - Process doc URLs - A lot of these end with a dollar sign, which can confuse the renderer into thinking the following text is math. The dollar sign isn't needed in the URL so we strip it. - Fix headings - Some demos have custom classes at the very start of the document. These aren't used and conflict with the heading, so they are removed. - Use html for figures - This is the only way to apply scaling to the figures. - Misc. formatting issues and broken links. **Note**: I used 50% scaling for inline images and 25% for tables. _Most_ images are huge, so this seems reasonable, but happy to entertain other suggestions.
1 parent 90a6c8a commit 7e608d5

23 files changed

Lines changed: 46 additions & 59 deletions

File tree

conf.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,17 +76,15 @@
7676
# all example scripts in the 'examples_dirs' folder will be skiped.
7777
"filename_pattern": r"\.py$",
7878
"pypandoc": {
79-
"filters": [
79+
"filters": [ # These are applied in order
8080
"./lib/filter_directives.py",
81-
"./lib/filter_figures.py",
8281
"./lib/filter_links.py",
83-
"./lib/filter_tables.py"
82+
"./lib/filter_tables.py",
83+
"./lib/filter_figures.py",
8484
]
8585
},
8686
# first notebook cell in generated Jupyter notebooks
8787
"first_notebook_cell": (
88-
"# This cell is added by sphinx-gallery\n"
89-
"# It can be customized to whatever you like\n"
9088
"%matplotlib inline"
9189
),
9290
# thumbnail size

demonstrations_v2/tutorial_dqi/metadata.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"executable_stable": true,
99
"executable_latest": true,
1010
"dateOfPublication": "2025-09-19T10:00:00+00:00",
11-
"dateOfLastModification": "2025-11-26T15:48:14+00:00",
11+
"dateOfLastModification": "2025-12-19T00:00:00+00:00",
1212
"categories": [
1313
"Algorithms"
1414
],
@@ -83,4 +83,4 @@
8383
"weight": 1.0
8484
}
8585
]
86-
}
86+
}

demonstrations_v2/tutorial_grovers_algorithm/metadata.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"executable_stable": true,
99
"executable_latest": true,
1010
"dateOfPublication": "2023-07-03T00:00:00+00:00",
11-
"dateOfLastModification": "2025-09-22T15:48:14+00:00",
11+
"dateOfLastModification": "2025-12-19T00:00:00+00:00",
1212
"categories": [
1313
"Getting Started",
1414
"Algorithms",
@@ -38,4 +38,4 @@
3838
}
3939
],
4040
"discussionForumUrl": "https://discuss.pennylane.ai/t/understanding-grover/3340"
41-
}
41+
}

demonstrations_v2/tutorial_intro_amplitude_amplification/metadata.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"executable_stable": true,
1212
"executable_latest": true,
1313
"dateOfPublication": "2024-05-07T00:00:00+00:00",
14-
"dateOfLastModification": "2025-09-22T15:48:14+00:00",
14+
"dateOfLastModification": "2025-12-19T00:00:00+00:00",
1515
"categories": [
1616
"Quantum Computing",
1717
"Algorithms"
@@ -84,4 +84,4 @@
8484
"weight": 1.0
8585
}
8686
]
87-
}
87+
}

demonstrations_v2/tutorial_multiclass_classification/demo.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
r"""
2-
.. _multiclass_margin_classifier:
3-
42
Multiclass margin classifier
53
============================
64

demonstrations_v2/tutorial_multiclass_classification/metadata.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"executable_stable": true,
99
"executable_latest": true,
1010
"dateOfPublication": "2020-04-09T00:00:00+00:00",
11-
"dateOfLastModification": "2025-09-22T15:48:14+00:00",
11+
"dateOfLastModification": "2025-12-19T00:00:00+00:00",
1212
"categories": [
1313
"Algorithms"
1414
],
@@ -36,4 +36,4 @@
3636
"weight": 1.0
3737
}
3838
]
39-
}
39+
}

demonstrations_v2/tutorial_neutral_atoms/demo.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
r""".. _neutral:
2-
1+
r"""
32
Neutral-atom quantum computers
4-
=============================
3+
==============================
54
65
.. meta::
76
:property="og:description": Learn how neutral atom quantum devices work using code

demonstrations_v2/tutorial_neutral_atoms/metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"executable_stable": true,
99
"executable_latest": true,
1010
"dateOfPublication": "2023-05-30T00:00:00+00:00",
11-
"dateOfLastModification": "2025-11-10T00:00:00+00:00",
11+
"dateOfLastModification": "2025-12-19T00:00:00+00:00",
1212
"categories": [
1313
"Quantum Hardware",
1414
"Quantum Computing"

demonstrations_v2/tutorial_phase_kickback/demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
# :align: center
3636
# :width: 50%
3737
#
38-
# If you want to know more about the details, do not hesitate to consult the node `[P.1] </codebook/09-quantum-phase-estimation/01-catch-the-phase/>`_ of the PennyLane Codebook.
38+
# If you want to know more about the details, do not hesitate to consult the node `[P.1] <https://pennylane.ai/codebook/quantum-phase-estimation/catch-the-phase>`_ of the PennyLane Codebook.
3939

4040
######################################################################
4141
# Setting up PennyLane

demonstrations_v2/tutorial_phase_kickback/metadata.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"executable_stable": true,
99
"executable_latest": true,
1010
"dateOfPublication": "2023-08-01T00:00:00+00:00",
11-
"dateOfLastModification": "2025-10-15T00:00:00+00:00",
11+
"dateOfLastModification": "2025-12-19T00:00:00+00:00",
1212
"categories": [
1313
"Getting Started",
1414
"Algorithms",
@@ -37,4 +37,4 @@
3737
"weight": 1.0
3838
}
3939
]
40-
}
40+
}

0 commit comments

Comments
 (0)