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
Prev Previous commit
Next Next commit
🧪 Extending config test case
fwkoch committed May 21, 2024
commit 68c49298db5f6557a80a75ce3e37df45398d7e53
8 changes: 8 additions & 0 deletions packages/mystmd/tests/exports.yml
Original file line number Diff line number Diff line change
@@ -144,3 +144,11 @@ cases:
outputs:
- path: notebook-fig-embed/_build/site/content/index.json
content: notebook-fig-embed/outputs/index.json
- title: Extend config test
cwd: extend-config/proj-a
command: myst build
outputs:
- path: extend-config/proj-a/_build/site/content/index.json
content: outputs/extend-config-index.json
- path: extend-config/proj-a/_build/site/config.json
content: outputs/extend-config-config.json
3 changes: 3 additions & 0 deletions packages/mystmd/tests/extend-config/proj-a/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Testing Config

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
15 changes: 15 additions & 0 deletions packages/mystmd/tests/extend-config/proj-a/myst.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: 1
project:
id: 7c806d98-0093-41ae-9889-dea2b9019064
title: MyST Config Extend Test
math:
a: defined-in-project-a
b: defined-in-project-a
site:
template: ../../templates/site/myst/book-theme
nav: []
actions:
- title: Learn More
url: https://mystmd.org/guide
domains: []
extends: ../proj-b/myst.yml
20 changes: 20 additions & 0 deletions packages/mystmd/tests/extend-config/proj-b/myst.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
version: 1
project:
id: 36470d68-33d2-4b16-b0cf-5c955396fe57
keywords:
- my-kw
authors:
- John Doe
license: CC-BY-4.0
math:
a: defined-in-project-b
c: defined-in-project-b
site:
template: book-theme
nav: []
actions:
- title: Learn More
url: https://mystmd.org/guide
domains: []
extends:
- ../proj-c/macros.yml
6 changes: 6 additions & 0 deletions packages/mystmd/tests/extend-config/proj-c/macros.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 1
project:
math:
a: defined-in-project-c
c: defined-in-project-c
d: defined-in-project-c
34 changes: 34 additions & 0 deletions packages/mystmd/tests/outputs/extend-config-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"options": {},
"nav": [],
"actions": [
{ "title": "Learn More", "url": "https://mystmd.org/guide", "internal": false, "static": false }
],
"projects": [
{
"license": {
"content": {
"id": "CC-BY-4.0",
"name": "Creative Commons Attribution 4.0 International",
"free": true,
"CC": true,
"url": "https://creativecommons.org/licenses/by/4.0/"
}
},
"math": {
"a": "defined-in-project-a",
"c": "defined-in-project-b",
"d": "defined-in-project-c",
"b": "defined-in-project-a"
},
"title": "MyST Config Extend Test",
"authors": [{ "id": "John Doe", "name": "John Doe" }],
"keywords": ["my-kw"],
"id": "7c806d98-0093-41ae-9889-dea2b9019064",
"exports": [],
"bibliography": [],
"index": "index",
"pages": []
}
]
}
60 changes: 60 additions & 0 deletions packages/mystmd/tests/outputs/extend-config-index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"kind": "Article",
"sha256": "b956ef955e38d755ee949dded619a8cbcd7dfbe7e33d368ab867a1aab49992ee",
"slug": "index",
"location": "/index.md",
"dependencies": [],
"frontmatter": {
"title": "Testing Config",
"content_includes_title": false,
"authors": [{ "id": "John Doe", "name": "John Doe" }],
"license": {
"content": {
"id": "CC-BY-4.0",
"name": "Creative Commons Attribution 4.0 International",
"free": true,
"CC": true,
"url": "https://creativecommons.org/licenses/by/4.0/"
}
},
"keywords": ["my-kw"],
"math": {
"a": "defined-in-project-a",
"c": "defined-in-project-b",
"d": "defined-in-project-c",
"b": "defined-in-project-a"
},
"exports": [
{
"format": "md",
"filename": "index.md",
"url": "/index-552a182d983b86e4781eb9df6c156089.md"
}
]
},
"mdast": {
"type": "root",
"children": [
{
"type": "block",
"children": [
{
"type": "paragraph",
"position": { "start": { "line": 3, "column": 1 }, "end": { "line": 3, "column": 1 } },
"children": [
{
"type": "text",
"value": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
"position": {
"start": { "line": 3, "column": 1 },
"end": { "line": 3, "column": 1 }
}
}
]
}
]
}
]
},
"references": { "cite": { "order": [], "data": {} } }
}