Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dev-environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ dependencies:
- black
- voici
- pip:
- .
- .[markdown]
- jupyterlite-xeus >=2.1.2
11 changes: 10 additions & 1 deletion jupyterlite_sphinx/jupyterlite_sphinx.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,13 @@
new_code_cell,
)

import jupytext
import nbformat

try:
import jupytext
except ImportError:
jupytext = None

try:
import voici
except ImportError:
Expand Down Expand Up @@ -617,6 +621,11 @@ def run(self):
notebook_is_stripped: bool = self.env.config.strip_tagged_cells

if notebook_path.suffix.lower() == ".md":
if jupytext is None:
raise ImportError(
"jupyterlite-sphinx requires the jupytext package to process Markdown notebooks. "
'Install "jupyterlite-sphinx[markdown]" with your package manager of choice.'
)
if self._target_is_stale(notebook_path, target_path):
nb = jupytext.read(str(notebook_path))
if notebook_is_stripped:
Expand Down
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@ dependencies = [
"jupyter_server",
"jupyterlab_server",
"jupyterlite-core >=0.2,<0.8",
"jupytext",
"nbformat",
"sphinx>=4",
]

[project.optional-dependencies]
markdown = ["jupytext"]

[dependency-groups]
dev = [
"hatch",
Expand Down
Loading