Server MD with Rust

This commit is contained in:
Jarek Rozanski 2026-01-28 20:56:35 +01:00
commit 3899ecce2f
14 changed files with 2823 additions and 0 deletions

View file

@ -0,0 +1,5 @@
# Deep Nested Path
This demonstrates that the server can handle deeply nested paths.
The URL `/any/deep/nested/path` maps to this file.

15
sample/content/foo/bar.md Normal file
View file

@ -0,0 +1,15 @@
# Hello World
This is a sample markdown file served at `/foo/bar`.
## Features
- Markdown support
- Automatic HTML conversion
- URL path based on file location
```rust
fn main() {
println!("Hello from Rust!");
}
```

17
sample/content/index.md Normal file
View file

@ -0,0 +1,17 @@
# Welcome to Markdown Server
This is the home page served at `/`.
## Available Pages
- [/foo/bar](foo/bar) - Sample page
- [/zap/zap](zap/zap) - Another test page
- [/any/deep/nested/path](any/deep/nested/path) - Deep nesting example
## How it works
The server automatically:
1. Takes the URL path
2. Looks for a corresponding `.md` file in the `./content` directory
3. Converts Markdown to HTML
4. Serves the result

11
sample/content/zap/zap.md Normal file
View file

@ -0,0 +1,11 @@
# Zap Zap Page
This is the zap/zap page served at `/zap/zap`.
## Testing
The server should resolve any path to the corresponding `.md` file in the content directory.
- Path: `/zap/zap` → File: `./content/zap/zap.md`
- Path: `/foo/bar` → File: `./content/foo/bar.md`
- Path: `/any/deep/nested/path` → File: `./content/any/deep/nested/path.md`