-
Notifications
You must be signed in to change notification settings - Fork 72
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
Conversation
There was a problem hiding this 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...
docs/frontmatter.md
Outdated
@@ -54,6 +54,25 @@ project: | |||
open_access: true | |||
``` | |||
|
|||
(composing-myst-yml)= | |||
:::{note} Composing multiple `.yml` files |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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.
docs/frontmatter.md
Outdated
@@ -54,6 +54,25 @@ project: | |||
open_access: true | |||
``` | |||
|
|||
(composing-myst-yml)= | |||
:::{note} Composing multiple `.yml` files |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
I was just thinking of looking at this in the coming week. How exciting!!! |
7c45e94
to
49882d5
Compare
This PR allows users to have project frontmatter defined in multiple files (all of the same
myst.yml
format), then the mainmyst.yml
can bring in those other files under the top levelextends
key. A small example has been added to the docs.