Skip to content

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
Contributor

@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...

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

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.

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

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
Collaborator

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
Contributor

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

@fwkoch fwkoch force-pushed the feat/myst-yml-template branch from 7c45e94 to 49882d5 Compare May 21, 2024 20:14
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.

5 participants