Authoring Guide
Authoring Guide
Section titled “Authoring Guide”Use this guide when adding or updating pages in the Interview Handbook. Pages are plain Markdown in src/content/docs/, rendered by Starlight (Astro), and validated during the production build.
Create a page
Section titled “Create a page”- Place the Markdown file in the closest subject directory under
src/content/docs/topics/, orsrc/content/docs/interview-guide/for interview material. - Use a short lowercase kebab-case filename, such as
portfolio-risk.md. - Add YAML frontmatter with at least a
title. - Add the page to the
sidebararray inastro.config.mjs. - Link related pages using absolute slug paths.
- Run
npm run buildbefore pushing.
Use index.md as the landing page for each directory. Keep display order and labels in astro.config.mjs rather than adding numeric prefixes to filenames.
src/├── content/docs/│ ├── index.md│ ├── authoring.md│ ├── interview-guide/│ └── topics/├── assets/images/├── pages/tags.astro└── styles/custom.csspublic/└── topics/ds-ml/notebooks/astro.config.mjsAnything outside src/content/docs/ is never published. That is why working directories such as 10_interviews/ and leonteq/ stay private — do not move them into the content directory.
Page metadata
Section titled “Page metadata”Front matter controls browser metadata and optional page behavior:
---title: Portfolio Riskdescription: Common portfolio risk measures and interview questions.tags: - Finance - Riskhide: - toc---Use a concise title and a description that makes sense in search results. Remove hide when the page benefits from the table of contents.
Navigation
Section titled “Navigation”Add new pages to the sidebar array in astro.config.mjs. Entries use slug for content pages, or link for standalone routes:
sidebar: [ { label: 'Topics', items: [ { label: 'Finance', items: [ { label: 'Overview', slug: 'topics/finance' }, { label: 'Risk', slug: 'topics/finance/risk' }, { label: 'Portfolio Risk', slug: 'topics/finance/portfolio-risk' }, ], }, ], },]Starlight provides breadcrumbs, previous/next links, a following table of contents, and a built-in search index.
Links and assets
Section titled “Links and assets”Internal links use absolute slug paths including the site base, and end with a slash:
[Risk](/ryantjx-handbook/topics/finance/risk/)[Data Science](/ryantjx-handbook/topics/ds-ml/)The build fails on a broken internal link, so a typo cannot ship silently.
Store shared images under src/assets/images/<subject>/ and provide useful alternative text. Image paths are relative to the Markdown file:
Files that should be downloadable rather than rendered as pages belong in public/, which is copied verbatim to the site root.
Admonitions and collapsible sections
Section titled “Admonitions and collapsible sections”Use admonitions for information that should stand apart from the main text:
:::tip
Compare an algorithm's time and space complexity before choosing it.
:::
:::caution
Historical performance does not guarantee future returns.
:::
<details><summary>Worked example</summary>
This explanation is collapsed until the reader opens it.
</details>Use them selectively; too many callouts make the important ones harder to notice.
Code blocks
Section titled “Code blocks”Always provide a language identifier. Optional titles and highlighted lines make examples easier to scan:
```python title="expected_value.py" hl_lines="2"def expected_value(values, probabilities): return sum(value * probability for value, probability in zip(values, probabilities))```Line numbers can be enabled per block:
```python linenums="1"prices = [100, 101, 99]returns = [prices[i] / prices[i - 1] - 1 for i in range(1, len(prices))]```The copy button is enabled globally.
Code annotations
Section titled “Code annotations”Annotations attach explanations directly to code:
```pythoncache = {} # (1)```
1. The dictionary stores previously computed results.Content tabs
Section titled “Content tabs”Use tabs to compare languages, approaches, or platforms without repeating surrounding prose:
=== "Python"
```python values = sorted(values) ```
=== "SQL"
```sql SELECT * FROM values ORDER BY value; ```Tabs with the same labels are synchronized across the site.
Tables and definition lists
Section titled “Tables and definition lists”Use tables when readers need to compare the same attributes:
| Measure | Captures | Limitation || --- | --- | --- || VaR | Loss threshold | Ignores losses beyond the threshold || Expected shortfall | Average tail loss | More data-sensitive |Use definition lists for terminology and glossaries:
Value at Risk: An estimate of the potential loss over a defined period at a given confidence level.
Expected Shortfall: The average loss beyond the Value at Risk threshold.Formatting and keyboard keys
Section titled “Formatting and keyboard keys”The following additional syntax is available:
- ==Important interview point==- H~2~O- x^2^- ~~Deprecated approach~~- Press ++ctrl+c++Use formatting to clarify meaning, not as decoration.
Task lists
Section titled “Task lists”Task lists work well for study plans and page-completion checklists:
- [x] Review probability distributions- [ ] Practice conditional expectation- [ ] Complete a Monte Carlo exerciseDiagrams
Section titled “Diagrams”Mermaid diagrams are rendered directly from fenced text and automatically follow the light or dark color scheme:
```mermaidflowchart LR Data --> Clean Clean --> Model Model --> Evaluate```Useful diagram types include flowcharts, sequence diagrams, state diagrams, class diagrams, and entity-relationship diagrams.
Mathematical notation
Section titled “Mathematical notation”MathJax renders inline and block LaTeX. Use \(...\) inline:
The expected value is \(E[X]\).Use \[...\] or $$...$$ on separate lines for display equations:
\[\operatorname{VaR}_{\alpha}(X)=\inf\{x \mid P(X \leq x) \geq \alpha\}\]MathJax is loaded from a public CDN, so equations require network access when the site is viewed.
Footnotes and tooltips
Section titled “Footnotes and tooltips”Footnotes are displayed as hoverable tooltips while remaining accessible at the bottom of the page:
Expected shortfall is also known as conditional value at risk.[^1]
[^1]: Naming conventions vary across texts and regulators.Add a tooltip to a link with its optional title:
[Starlight](https://starlight.astro.build/ "Theme documentation")Reusable content
Section titled “Reusable content”Starlight has no include directive. Keep shared prose short enough to duplicate, or move it into an Astro component under src/components/ and import it from a .mdx page.
Tags connect pages across the folder hierarchy. Add them in front matter:
---tags: - Python - Cheatsheet - Data Science---The generated Tags page lists tagged content. Prefer a small, consistent vocabulary rather than creating near-duplicates such as Machine Learning, ML, and machine-learning.
Search-friendly writing
Section titled “Search-friendly writing”- Give every page a unique, descriptive heading.
- Put important terminology in headings and introductory paragraphs.
- Prefer focused pages over very long collections of unrelated notes.
- Cross-link related concepts using descriptive link text.
- Add a useful
descriptionin front matter. - Use tables for comparisons and code fences for executable examples.
Notebooks
Section titled “Notebooks”.ipynb files are not rendered as pages. Store them under public/ so they are served as downloads, and keep the explanatory prose in a Markdown page beside them. Add a notebook-rendering integration only if readers genuinely need rendered outputs.
Preview and validate
Section titled “Preview and validate”Install dependencies once, then start the live preview:
npm installnpm run devOpen http://localhost:4321/ryantjx-handbook/. Saved changes to src/content/docs/ and astro.config.mjs reload automatically.
Before pushing, run the same production build used by GitHub Actions:
npm run buildThe build fails on broken internal links, missing images, and pages without a title. These are errors rather than warnings, so they cannot ship silently.
Publish
Section titled “Publish”Push to main. The workflow in .github/workflows/pages.yml builds and deploys the site. GitHub Pages must use Settings → Pages → Build and deployment → Source: GitHub Actions.