Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Add extends field to myst.yml for composing multiple yamls #1215

Merged
merged 11 commits into from
May 21, 2024

Conversation

fwkoch
Copy link
Member

@fwkoch fwkoch commented May 17, 2024

This PR allows users to have project frontmatter defined in multiple files (all of the same myst.yml format), then the main myst.yml can bring in those other files under the top level extends key. A small example has been added to the docs.

Copy link
Member

@stevejpurves stevejpurves left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good! would perhaps just add some tests around existing Page->Project frontmatter inheritance, since the function that was doing that previously looks like it has been made generic? and is now doing Project->Project as well as Page->Project filling...

@@ -54,6 +54,25 @@ project:
open_access: true
```

(composing-myst-yml)=
:::{note} Composing multiple `.yml` files
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the TOC PR gets in before this one is finished:

I'd recommend using that as an example here. I think a common use-case will be to have a separate toc.yml file and use this feature to bring it in (for communities that have a lot of TOC content and thus don't want to have to scroll through a huge list of pages in their config file)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense - I'll update, depending on the order these come in...

I also suspect we will be scattering this all around the docs. E.g. where we talk about math macros, we can say "reference external macros by..." and where we talk about the toc, "reference external toc by..." etc. So hopefully this one little section won't be the only mention in the docs, long term.

@@ -54,6 +54,25 @@ project:
open_access: true
```

(composing-myst-yml)=
:::{note} Composing multiple `.yml` files
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be a subsection instead of a note? That way it is easier to discover in the table of contents

site: ...
project: ...
extends:
- ../macros.yml
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this work for externally-defined .yml files? (e.g. in a different github repository?)

If not, then would it be possible to download external files locally as part of the build process in a way that would work as expected here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently the files must be available locally, from a relative path at build-time (they can be outside the MyST project).

I agree we should be able to also put a url here, e.g.:

extends:
  - https://example.com/my-other-myst.yml

We get into a discussion of this over here: #336

But I think the url download/caching is a separate (smaller) PR.

@agoose77
Copy link
Collaborator

I was just thinking of looking at this in the coming week. How exciting!!!

@fwkoch fwkoch merged commit f4d5231 into main May 21, 2024
5 checks passed
@fwkoch fwkoch deleted the feat/myst-yml-template branch May 21, 2024 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants