diff --git a/docs/index.md b/docs/index.md index 323f4a1b..f7ee61d1 100644 --- a/docs/index.md +++ b/docs/index.md @@ -44,10 +44,20 @@ To install `myst-nb`, do the following: ] ``` - ```{note} - If you'd like to use MyST to parse markdown files as well, then you can enable it by - adding `myst_parser` to your list of extensions as well. - ``` +By default, MyST-NB will parse both markdown (`.md`) and notebooks (`.ipynb`). +You can also change which files are parsed by MyST-NB using +the [source_suffix](https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-source_suffix) +option in your `conf.py`, e.g.: + +```python +extensions = ["myst_nb"] +source_suffix = { + '.rst': 'restructuredtext', + '.ipynb': 'myst-nb', + '.myst': 'myst-nb', +} +``` + * Write Jupyter Notebooks with your built documentation, and remember to include them in your `toctree`, and that's it! diff --git a/myst_nb/converter.py b/myst_nb/converter.py index 6988a017..edac67d9 100644 --- a/myst_nb/converter.py +++ b/myst_nb/converter.py @@ -57,7 +57,10 @@ def is_myst_notebook(line_iter): break yaml_lines.append(line.rstrip() + "\n") - front_matter = yaml.safe_load("".join(yaml_lines)) + try: + front_matter = yaml.safe_load("".join(yaml_lines)) + except Exception: + return False if ( front_matter.get("jupytext", {}) .get("text_representation", {})