Skip to content

Commit 7087d07

Browse files
docs: add Quick Guide to MyST
1 parent d0f9985 commit 7087d07

File tree

12 files changed

+124
-44
lines changed

12 files changed

+124
-44
lines changed

afterpython/_website/src/routes/+layout.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
Documentation
3434
</a>
3535
</li>
36-
<li>
36+
<!-- <li>
3737
<a href={'/tutorial'}>Tutorials</a>
3838
</li>
3939
<li>
@@ -44,7 +44,7 @@
4444
</li>
4545
<li>
4646
<a href={'/blog'}>Blog</a>
47-
</li>
47+
</li> -->
4848
<!-- <li>
4949
<a href={'/exercises'}>Exercises</a>
5050
</li>
216 KB
Loading
226 KB
Loading

afterpython/blog/myst.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,16 @@ site:
4848
logo_url: https://afterpython.afterpython.org
4949
title: afterpython's Blog
5050
nav:
51-
- title: Docs
52-
url: https://afterpython.afterpython.org/doc
51+
- title: AfterPython.Org
52+
url: https://afterpython.org
53+
- title: Guides
54+
url: https://afterpython.afterpython.org/guide
5355
- title: Tutorials
5456
url: https://afterpython.afterpython.org/tutorial
57+
- title: Docs
58+
url: https://afterpython.afterpython.org/doc
5559
- title: Examples
5660
url: https://afterpython.afterpython.org/example
57-
- title: Guides
58-
url: https://afterpython.afterpython.org/guide
5961
actions:
6062
- title: ⭐ Star
6163
url: https://github.com/AfterPythonOrg/afterpython

afterpython/builders/metadata.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def convert_paths():
2323
markdown_text = metadata["description"]
2424

2525
# Replace with the correct paths
26-
updated_markdown = markdown_text.replace("./afterpython/static/", "/")
26+
updated_markdown = markdown_text.replace("afterpython/static/", "/")
2727

2828
# Write back to metadata.json
2929
metadata["description"] = updated_markdown

afterpython/cli/commands/sync.py

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,20 @@ def sync():
5555
company_url = str(_from_tomlkit(afterpython["company"]).get("url", ""))
5656
website_url = str(_from_tomlkit(afterpython["website"]).get("url", ""))
5757
authors = pyproject.authors
58-
nav_bar = [
59-
{
60-
"title": content_type.capitalize() + "s",
61-
"url": f"{website_url}/{content_type}",
62-
}
63-
if website_url
64-
else ""
65-
for content_type in CONTENT_TYPES
66-
]
58+
if company_name and company_url:
59+
nav_bar = [{"title": company_name, "url": company_url}]
60+
else:
61+
nav_bar = []
62+
if website_url:
63+
nav_bar.extend(
64+
[
65+
{
66+
"title": content_type.capitalize() + "s",
67+
"url": f"{website_url}/{content_type}",
68+
}
69+
for content_type in CONTENT_TYPES
70+
]
71+
)
6772

6873
_sync_authors_yml(authors)
6974

afterpython/doc/myst.md

Lines changed: 72 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,83 @@
1-
[MyST Markdown]: https://mystmd.org/spec/
1+
[MyST Documentation]: https://mystmd.org
2+
[MyST Specification]: https://mystmd.org/spec/
3+
[MyST History]: https://mystmd.org/guide/background#what-is-the-myst-document-engine-and-myst-markdown
4+
[MyST Overview]: https://mystmd.org/guide/overview
25
[Jupyter Notebook]: https://jupyter.org
3-
[MyST Document Engine]: https://mystmd.org/guide/background#what-is-the-myst-document-engine-and-myst-markdown
46
[template]: https://github.com/AfterPythonOrg/project-website-template
7+
[JupyterBook]: https://jupyterbook.org/stable/
8+
[molab]: https://molab.marimo.io/
9+
[Marimo]: https://marimo.io/
510

6-
# MyST
11+
# Quick Guide to MyST
712

8-
## Common Markdown
13+
:::{attention}
14+
This section serves as a quick guide to MyST. Quotes below are sourced from the [MyST Documentation], where you can find more comprehensive information.
15+
:::
916

10-
## MyST Markdown
1117

12-
## Jupyter Notebooks
13-
add molab badge
18+
## What is MyST?
19+
> MyST (Markedly Structured Text) is designed to create publication-quality, computational documents written entirely in Markdown. The main use case driving the development and design of MyST is [JupyterBook], which creates educational online textbooks and tutorials with Jupyter Notebooks and narrative content written in MyST.
1420
21+
22+
### MyST Markdown vs Common Markdown
23+
> MyST is a superset of CommonMark (a standard form of Markdown) and allows you to directly create “directives” and “roles” as extension points in the language. These extensions points are influenced by ReStructured Text (RST) and Sphinx -- pulling on the nomenclature and introducing additional standards where appropriate. directives are block-level extension points, like callout panels, tabs, figures or embedded charts; and roles are inline extension points, for components like references, citations, or inline math.
24+
25+
- **See [this](https://mystmd.org/guide/quickstart-myst-markdown) for a quick start guide to MyST Markdown's syntax.**
26+
- See [MyST Specification] and [MyST History] for more details about what MyST is.
27+
28+
29+
---
30+
## Jupyter Notebook
31+
The [MyST Document Engine][MyST Overview] can parse [Jupyter Notebook]s and render them as HTML. This means you can write content in both MyST Markdown and Jupyter Notebooks—`afterpython` will organize and render them together as part of your project website.
32+
33+
### Molab Badge
34+
35+
If the [environment variable](references/environment_variables.md) `AP_MOLAB_BADGE` is set to `1`, `afterpython` automatically adds [molab] badges to Jupyter Notebooks during the build process.
36+
37+
:::{note}
38+
[molab] is a cloud service by [Marimo] that supports running Jupyter Notebooks in the cloud. The badge lets users open your notebooks and run them in the cloud for free.
39+
:::
40+
41+
42+
---
1543
## myst.yml
44+
`myst.yml` is a configuration file for MyST, and since `afterpython` uses MyST to build content, each directory (`doc/`, `blog/`, `tutorial/`, `example/`, and `guide/`) has its own `myst.yml` configuration file. This allows you to customize MyST's behavior per directory.
45+
46+
### Configuration Structure
47+
48+
A `myst.yml` file contains two main sections:
49+
50+
**`project`** — Project-level settings such as description, keywords, and GitHub URL.
51+
52+
*See [Frontmatter](https://mystmd.org/guide/frontmatter#available-frontmatter-fields) for all available options.*
53+
54+
**`site`** — Website-level settings such as template, site title, logo, and favicon.
55+
56+
*See [Site Options](https://mystmd.org/guide/website-templates#available-website-template-options) for all available options.*
57+
58+
:::{caution} Bug Report
59+
Some settings in `myst.yml` may not work as expected, and you may need to report the bugs on [`mystmd` GitHub Issues](https://github.com/jupyter-book/mystmd/issues).
60+
61+
Please do **_NOT_** report `mystmd` bugs on `afterpython` repository.
62+
:::
63+
64+
### Table of Contents (TOC)
65+
The `toc` subsection under `project` in `myst.yml` defines how your content is organized.
66+
67+
You can run `myst init --write-toc` in your content directory (e.g., `afterpython/doc/`) to automatically generate a TOC based on your existing content.
68+
69+
*See [Table of Contents](https://mystmd.org/guide/table-of-contents) for more details.*
1670

17-
## TOC
71+
### authors.yml
72+
When you run `ap init`, `afterpython` creates an `authors.yml` file in the `afterpython/` directory and syncs authors from `pyproject.toml`. This allows you to easily manage the authors of your project.
1873

19-
## VSCode Extension
74+
*See [Authorship](https://mystmd.org/guide/authorship#skip-to-frontmatter), you can add social media links to your authors in `authors.yml` (e.g. GitHub, X, etc.)*
2075

21-
## authors.yml
76+
#### Change Author at Page Level
77+
By default, authors defined in `authors.yml` will all be used in `myst.yml` at the project level (see `project.authors` in `myst.yml`). However, you can override this behavior at the page level by adding the `authors` frontmatter at the top of your content (e.g. `doc/your_page.md`):
78+
```markdown
79+
---
80+
authors:
81+
- new_author_id_defined_in_authors_yml
82+
---
83+
```

afterpython/doc/myst.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,16 @@ site:
6868
analytics_google: "{{ GOOGLE_ANALYTICS_ID }}"
6969
title: afterpython's Doc
7070
nav:
71-
- title: Blogs
72-
url: https://afterpython.afterpython.org/blog
71+
- title: AfterPython.Org
72+
url: https://afterpython.org
73+
- title: Guides
74+
url: https://afterpython.afterpython.org/guide
7375
- title: Tutorials
7476
url: https://afterpython.afterpython.org/tutorial
7577
- title: Examples
7678
url: https://afterpython.afterpython.org/example
77-
- title: Guides
78-
url: https://afterpython.afterpython.org/guide
79+
- title: Blogs
80+
url: https://afterpython.afterpython.org/blog
7981
actions:
8082
- title: ⭐ Star
8183
url: https://github.com/AfterPythonOrg/afterpython

afterpython/doc/references/environment_variables.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
# Environment Variables
1+
---
2+
authors:
3+
- new_author_id_defined_in_authors_yml
4+
---
25

3-
## `UV_PUBLISH_TOKEN`
6+
# Environment Variables
47

58
## `AP_AUTO_SYNC`
69

afterpython/example/myst.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,16 @@ site:
4848
logo_url: https://afterpython.afterpython.org
4949
title: afterpython's Example
5050
nav:
51+
- title: AfterPython.Org
52+
url: https://afterpython.org
53+
- title: Guides
54+
url: https://afterpython.afterpython.org/guide
55+
- title: Tutorials
56+
url: https://afterpython.afterpython.org/tutorial
5157
- title: Docs
5258
url: https://afterpython.afterpython.org/doc
5359
- title: Blogs
5460
url: https://afterpython.afterpython.org/blog
55-
- title: Tutorials
56-
url: https://afterpython.afterpython.org/tutorial
57-
- title: Guides
58-
url: https://afterpython.afterpython.org/guide
5961
actions:
6062
- title: ⭐ Star
6163
url: https://github.com/AfterPythonOrg/afterpython

0 commit comments

Comments
 (0)