{"id":14977093,"url":"https://github.com/fanchengyan/myst-sphinx-gallery","last_synced_at":"2025-10-27T23:31:55.521Z","repository":{"id":252367290,"uuid":"840234126","full_name":"Fanchengyan/myst-sphinx-gallery","owner":"Fanchengyan","description":"A Sphinx extension that builds galleries from any set of myst-style markdown/notebook or rst files.","archived":false,"fork":false,"pushed_at":"2024-09-13T06:23:07.000Z","size":11528,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-11T14:42:41.314Z","etag":null,"topics":["docutils","gallery","jupyter","markdown","parser","sphinx-extension"],"latest_commit_sha":null,"homepage":"https://myst-sphinx-gallery.readthedocs.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Fanchengyan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-09T08:57:39.000Z","updated_at":"2024-09-13T06:23:10.000Z","dependencies_parsed_at":"2024-08-09T10:16:49.476Z","dependency_job_id":"9693e35c-ea9f-40e4-80df-21e46cc60b1f","html_url":"https://github.com/Fanchengyan/myst-sphinx-gallery","commit_stats":null,"previous_names":["fanchengyan/myst-sphinx-gallery"],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fanchengyan%2Fmyst-sphinx-gallery","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fanchengyan%2Fmyst-sphinx-gallery/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fanchengyan%2Fmyst-sphinx-gallery/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fanchengyan%2Fmyst-sphinx-gallery/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Fanchengyan","download_url":"https://codeload.github.com/Fanchengyan/myst-sphinx-gallery/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219860467,"owners_count":16556017,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docutils","gallery","jupyter","markdown","parser","sphinx-extension"],"created_at":"2024-09-24T13:55:02.713Z","updated_at":"2025-10-27T23:31:48.594Z","avatar_url":"https://github.com/Fanchengyan.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/Fanchengyan/myst-sphinx-gallery/main/docs/source/_static/logo/logo.svg\" width=\"400\"\u003e\n\u003c/h1\u003e\u003cbr\u003e\n\n\n[![Conda Recipe](https://img.shields.io/badge/recipe-myst--sphinx--gallery-green.svg)](https://anaconda.org/conda-forge/myst-sphinx-gallery)\n[![Documentation Status](https://readthedocs.org/projects/myst-sphinx-gallery/badge/?version=latest)](https://myst-sphinx-gallery.readthedocs.io/en/latest/?badge=latest)\n[![Language](https://img.shields.io/badge/python-3.8%2B-blue.svg?style=flat-square)](https://www.python.org/)\n[![Conda Version](https://img.shields.io/conda/vn/conda-forge/myst-sphinx-gallery.svg)](https://anaconda.org/conda-forge/myst-sphinx-gallery)\n[![PyPI](https://img.shields.io/pypi/v/myst-sphinx-gallery)](https://pypi.org/project/myst-sphinx-gallery/)\n[![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/myst-sphinx-gallery.svg)](https://anaconda.org/conda-forge/myst-sphinx-gallery)\n[![tests](https://github.com/Fanchengyan/myst-sphinx-gallery/actions/workflows/tests.yml/badge.svg)](https://github.com/Fanchengyan/myst-sphinx-gallery/actions/workflows/tests.yml)\n[![codecov](https://codecov.io/gh/Fanchengyan/myst-sphinx-gallery/graph/badge.svg?token=IHXYE1K1G9)](https://codecov.io/gh/Fanchengyan/myst-sphinx-gallery)\n\n\n## Introduction\n\n**MyST Sphinx Gallery** is a Sphinx extension that allows you to build\ngalleries from jupyter notebooks (`.ipynb`), markdown (`.md`) or\nreStructuredText (`.rst`) files.\n\nThis extension is functionally similar to the\n[Sphinx-Gallery](https://sphinx-gallery.github.io/stable/index.html)\nextension, but aim to provide a simple and efficient way to create\ngalleries written in a variety of file formats.\n\n\n![gallery_example](docs/source/_static/gallery_example.png)\n\n## Highlight Features\n\n- **Easy to use** - It provides a set of `directives` to generate\n  galleries, as simple as adding `toctree`.\n- **Flexible** - You can easily generate a gallery of examples from your\n  Jupyter Notebooks, Markdown, or reStructuredText files. It works with `MyST` Ecosystem, including [MyST-parser](https://myst-parser.readthedocs.io/en/latest/) and [MyST-NB](https://myst-nb.readthedocs.io/en/latest/), to render markdown or jupyter notebooks in Sphinx documentation.\n- **Fast and robust** - It utilizes existing images to generate gallery\n  thumbnails, eliminating code execution delays and potential accidental errors\n  when building gallery.\n- **Customizable** - You can customize the gallery, such as thumbnail\n  selection, and style of the gallery.\n\n\n## Documentation\n\nThe detailed documentation is available at: [https://myst-sphinx-gallery.readthedocs.io/en/latest/](https://myst-sphinx-gallery.readthedocs.io/en/latest/)\n\n## Quick Start\n\n\u003e [!NOTE]\n\u003e The quick start guide here is a brief introduction to the MyST Sphinx Gallery extension. More detailed Quick Start guide is available at: [Quick Start](https://myst-sphinx-gallery.readthedocs.io/en/latest/user_guide/quick_start.html).\n\n\n## Installation\n\n**MyST Sphinx Gallery** is a Python package, and requires `Python \u003e= 3.8`. You can install the latest release using `pip` from the PyPI:\n\n```bash\npip install myst_sphinx_gallery\n```\n\nor using `conda` / `mamba` from the conda-forge channel:\n\n```bash\nconda install -c conda-forge myst-sphinx-gallery\n```\n\n```bash\nmamba install -c conda-forge myst-sphinx-gallery\n```\n\n## Configuring the extension\n\n### Enable the extension\n\nAfter installation, you can enable the extension in Sphinx `conf.py` file:\n\n```python\n  extensions = [\n      ...,  # other extensions\n      \"myst_sphinx_gallery\",\n  ]\n```\n\n\u003e[!IMPORTANT]\n\u003e**MyST Sphinx Gallery only helps you to generate the gallery**. You need to enable the MyST parsers to render the markdown or jupyter notebook files by yourself.\n\u003e\n\u003eFor instance, to enable the MyST-NB, you can add the following code to the `conf.py` file:\n\u003e\n\u003e```python\n\u003eextensions = [\n\u003e    ...,\n\u003e    \"myst_nb\",\n\u003e]\n\u003e\n\u003esource_suffix = {\n\u003e    \".rst\": \"restructuredtext\",\n\u003e    \".md\": \"myst-nb\",\n\u003e    \".myst\": \"myst-nb\",\n\u003e}\n\u003e```\n\u003e\n\u003eFor more information, please refer to the documentation of [MyST](https://myst-parser.readthedocs.io/en/latest/) and [MyST-NB](  https://myst-nb.readthedocs.io/en/latest/).\n\n## Configuring the variables\n\n\nMyST Sphinx Gallery has two main configuration variables that can be set in\nyour `conf.py` file.\n\n- `myst_sphinx_gallery_config` : **global configuration** for all examples\n  using gallery directives or used to **generate galleries**.\n- `myst_sphinx_gallery_files_config` : **configuration for individual files**\n  to override the global configuration for those files.\n\n\u003e [!TIP]\n\u003eThose two variables are optional and can be omitted if you don't need to  customize the behavior of MyST-Sphinx-Gallery.\n\nMore details about the configuration variables can be found in the\n[Configuration Variables](https://myst-sphinx-gallery.readthedocs.io/en/latest/user_guide/config.html) section.\n\n## Generating gallery\n\nThere are two ways to generate galleries in MyST Sphinx Gallery:\n\n1. **Using directives:** MyST Sphinx Gallery provides three directives for generating galleries: `base-gallery`, `gallery`, and `ref-gallery`. You can directly use these directives to generate galleries in reStructuredText (`.rst`), Markdown (`.md`), and Jupyter Notebook (`.ipynb`) files.\n2. **Configuring in conf.py:** You can also generate gallery by specifying the examples and gallery directories in your `conf.py` file. This method is keeping in line with [Sphinx Gallery](https://sphinx-gallery.github.io/stable/index.html) extension.\n\n\n\u003e [!NOTE]\n\u003e**Using directives** is highly recommended for generating galleries as it provides more options and flexibility. For instance, you can add `tooltip` to example cards, **call different directives multi-times in a single file** to generate a complex gallery. This cannot be done using the configuration method.\n\nYou can refer to the [Generating Galleries Methods](https://myst-sphinx-gallery.readthedocs.io/en/latest/user_guide/gen_gallery/index.html) section for more details.\n\n\n\n## Select the thumbnail for an example file\n\n- **one image** - If there only one image in an example file, no additional configuration is needed, and that image will be used as the gallery thumbnail.\n- **multiple images** - If there are multiple figures in an example file, you can specify the strategy to determine which thumbnail will be used for the gallery. The following strategies are supported:\n  1. **alt** - If the alt attribute of an image/figure is set to gallery_thumbnail, that image/figure will be used as the gallery thumbnail for this file.\n  2. **first/last** - If there are multiple images that can be used as the gallery thumbnail, the first/last image will be selected. You can specify the strategy by setting the thumbnail_strategy in the configuration file. The default value is first.\n  3. **code/markdown** - For Jupyter notebook files, both markdown and code cells can contain images. You can specify the strategy by setting the notebook_thumbnail_strategy in the configuration file. The default value is code.\n- **no image** - If no image/figure is found, the default thumbnail will be used.\n\n\nMore details can be found in the [Thumbnail Strategies](https://myst-sphinx-gallery.readthedocs.io/en/latest/user_guide/thumb.html).\n\n## Customizing style of thumbnail and card\n\nYou can customize the layout and thumbnail behaviors for the gallery using the MyST Sphinx Gallery extension. For more details, please refer to the section [Customizing Style of Thumbnail and Card\n](https://myst-sphinx-gallery.readthedocs.io/en/latest/user_guide/custom.html).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffanchengyan%2Fmyst-sphinx-gallery","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffanchengyan%2Fmyst-sphinx-gallery","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffanchengyan%2Fmyst-sphinx-gallery/lists"}