mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-03 09:53:45 +00:00
# What does this PR do? Add static file import system for docs - Use `remark-code-import` plugin to embed code at build time - Support importing Python code with syntax highlighting using `raw-loader` + `ReactMarkdown` One caveat is that currently when embedding markdown with code used the syntax highlighting isn't behaving but I'll investigate that in a follow up. ## Test Plan Python Example: <img width="1372" height="995" alt="Screenshot 2025-10-23 at 9 22 18 PM" src="https://github.com/user-attachments/assets/656d2c78-4d9b-45a4-bd5e-3f8490352b85" /> Markdown example: <img width="1496" height="1070" alt="Screenshot 2025-10-23 at 9 22 38 PM" src="https://github.com/user-attachments/assets/6c0a07ec-ff7c-45aa-b05f-8c46acd4445c" /> --------- Signed-off-by: Francisco Javier Arceo <farceo@redhat.com>
58 lines
2.2 KiB
Markdown
58 lines
2.2 KiB
Markdown
# Llama Stack Documentation
|
|
|
|
Here's a collection of comprehensive guides, examples, and resources for building AI applications with Llama Stack. For the complete documentation, visit our [Github page](https://llamastack.github.io/getting_started/quickstart).
|
|
|
|
## Render locally
|
|
|
|
From the llama-stack `docs/` directory, run the following commands to render the docs locally:
|
|
```bash
|
|
npm install
|
|
npm run gen-api-docs all
|
|
npm run build
|
|
npm run serve
|
|
```
|
|
You can open up the docs in your browser at http://localhost:3000
|
|
|
|
## File Import System
|
|
|
|
This documentation uses `remark-code-import` to import files directly from the repository, eliminating copy-paste maintenance. Files are automatically embedded during build time.
|
|
|
|
### Importing Code Files
|
|
|
|
To import Python code (or any code files) with syntax highlighting, use this syntax in `.mdx` files:
|
|
|
|
```markdown
|
|
```python file=./demo_script.py title="demo_script.py"
|
|
```
|
|
```
|
|
|
|
This automatically imports the file content and displays it as a formatted code block with Python syntax highlighting.
|
|
|
|
**Note:** Paths are relative to the current `.mdx` file location, not the repository root.
|
|
|
|
### Importing Markdown Files as Content
|
|
|
|
For importing and rendering markdown files (like CONTRIBUTING.md), use the raw-loader approach:
|
|
|
|
```jsx
|
|
import Contributing from '!!raw-loader!../../../CONTRIBUTING.md';
|
|
import ReactMarkdown from 'react-markdown';
|
|
|
|
<ReactMarkdown>{Contributing}</ReactMarkdown>
|
|
```
|
|
|
|
**Requirements:**
|
|
- Install dependencies: `npm install --save-dev raw-loader react-markdown`
|
|
|
|
**Path Resolution:**
|
|
- For `remark-code-import`: Paths are relative to the current `.mdx` file location
|
|
- For `raw-loader`: Paths are relative to the current `.mdx` file location
|
|
- Use `../` to navigate up directories as needed
|
|
|
|
## Content
|
|
|
|
Try out Llama Stack's capabilities through our detailed Jupyter notebooks:
|
|
|
|
* [Building AI Applications Notebook](./getting_started.ipynb) - A comprehensive guide to building production-ready AI applications using Llama Stack
|
|
* [Benchmark Evaluations Notebook](./notebooks/Llama_Stack_Benchmark_Evals.ipynb) - Detailed performance evaluations and benchmarking results
|
|
* [Zero-to-Hero Guide](./zero_to_hero_guide) - Step-by-step guide for getting started with Llama Stack
|