Contributing to the Workshop Docs¶
Code Snippets from the Repo¶
Code blocks in workshop docs must be pulled live from source files using MkDocs Snippets — never duplicated inline. This ensures docs and code can never silently diverge; a broken tag fails mkdocs build --strict.
1. Tag the source file¶
Tag names must be unique within a file. Use short kebab-case names.
2. Embed in the doc¶
Use a ??? example collapsible admonition with a GitHub button above the code block:
??? example "View source — description"
[:simple-github: Open in GitHub](https://github.com/aws-samples/sample-edge-to-cloud-digital-ops-workshop/blob/main/path/to/file){ .md-button target=_blank }
```typescript
\--8<-- "path/to/file.ts:my-section"
```
Paths in --8<-- "..." are resolved relative to the repo root (configured via base_path: [workshop, .] in mkdocs.yml).
3. Rules¶
- Never hardcode GitHub line-number URLs (e.g.
#L356) — they drift as files change. - Never duplicate code from
job-scripts/,amplify/, orfrontend/inline in docs. check_paths: truemeans a missing snippet path is a build error — if you rename a tagged file, update the docs at the same time.
Deployment ID and Account ID Substitution¶
All code blocks use two placeholders that are swapped client-side when the participant loads the docs:
| Placeholder | Query param | Example value |
|---|---|---|
ws-slot00 |
?did= |
ws-slot03 |
000000000000 |
?aid= |
123456789012 |
The facilitator shares a URL with both values embedded:
Both values persist in sessionStorage for the rest of the session. See workshop/javascripts/deployment-id.js for the implementation.
S3 bucket names in docs follow the pattern workshop-ws-slot00-000000000000 — both placeholders are present so the JS can substitute them independently.
Local Dev¶
# Install dependencies
pip install -r requirements.txt
# Serve with live reload
mkdocs serve
# Strict build (mirrors CI)
mkdocs build --strict
Exporting for Offline / Email Distribution¶
MkDocs' default directory-style URLs (page/index.html) don't work when opened from the local filesystem — browsers show a directory listing instead of the page. Use --no-directory-urls to generate flat .html files that work without a server:
Recipients unzip and open site/index.html directly in any browser.
CI¶
PRs that touch workshop/, job-scripts/, amplify/custom/participant-stack.ts, or mkdocs.yml trigger .github/workflows/docs-lint.yml, which runs:
mkdocs build --strict— fails on any broken snippet, bad internal ref, or unknown admonitionlycheelink checker against the built HTML — catches dead AWS doc links