Skip to content

Commit 07f21eb

Browse files
committed
docs: add markdown lint check and fix md lint style
Signed-off-by: yuluo-yx <[email protected]>
1 parent 7128765 commit 07f21eb

File tree

24 files changed

+286
-30
lines changed

24 files changed

+286
-30
lines changed

.github/workflows/pre-commit.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010
jobs:
1111
pre-commit:
1212
runs-on: ubuntu-latest
13-
name: Run pre-commit hooks on Go, Rust, JavaScripts and Python files
13+
name: Run pre-commit hooks on Go, Rust, JavaScripts, Markdown and Python files
1414

1515
steps:
1616
- name: Check out the repo
@@ -45,7 +45,8 @@ jobs:
4545
sudo apt-get install -y \
4646
make \
4747
build-essential \
48-
pkg-config
48+
pkg-config
49+
npm install markdownlint --save-dev
4950
5051
- name: Cache Rust dependencies
5152
uses: actions/cache@v4
@@ -81,10 +82,10 @@ jobs:
8182
- name: Install pre-commit
8283
run: pip install pre-commit
8384

84-
- name: Run pre-commit on Go, Rust, JavaScript and Python files
85+
- name: Run pre-commit on Go, Rust, JavaScript, Markdown and Python files
8586
run: |
86-
# Find all Go, Rust, JavaScripts and Python files (excluding vendored/generated code)
87-
FILES=$(find . -type f \( -name "*.go" -o -name "*.rs" -o -name "*.py" -o -name "*.js" \) \
87+
# Find all Go, Rust, JavaScripts, Markdown and Python files (excluding vendored/generated code)
88+
FILES=$(find . -type f \( -name "*.go" -o -name "*.rs" -o -name "*.py" -o -name "*.js" -o -name "*.md" \) \
8889
! -path "./target/*" \
8990
! -path "./candle-binding/target/*" \
9091
! -path "./.git/*" \
@@ -99,7 +100,7 @@ jobs:
99100
echo "Running pre-commit on files: $FILES"
100101
pre-commit run --files $FILES
101102
else
102-
echo "No Go, Rust, JavaScript or Python files found to check"
103+
echo "No Go, Rust, JavaScript, Markdown or Python files found to check"
103104
fi
104105
105106
- name: Show pre-commit results

.pre-commit-config.yaml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
# See https://pre-commit.com for more information
22
# See https://pre-commit.com/hooks.html for more hooks
33
repos:
4-
# Basic hooks for Go, Rust, Python files only
4+
# Basic hooks for Go, Rust, Python JavaScript And Markdown files only
55
- repo: https://github.com/pre-commit/pre-commit-hooks
66
rev: v6.0.0
77
hooks:
88
- id: trailing-whitespace
9-
files: \.(go|rs|py|js)$
9+
files: \.(go|rs|py|js|md)$
1010
- id: end-of-file-fixer
11-
files: \.(go|rs|py|js)$
11+
files: \.(go|rs|py|js|md)$
1212
- id: check-added-large-files
1313
args: ['--maxkb=500']
14-
files: \.(go|rs|py|js)$
14+
files: \.(go|rs|py|js|md)$
1515

1616
# Go specific hooks
1717
- repo: local
@@ -22,6 +22,16 @@ repos:
2222
language: system
2323
files: \.go$
2424

25+
# Markdown specific hooks
26+
- repo: local
27+
hooks:
28+
- id: md-fmt
29+
name: md fmt
30+
entry: bash -c "make markdown-lint"
31+
language: system
32+
files: \.md$
33+
exclude: ^(\node_modules/)
34+
2535
# JavaScript specific hooks
2636
- repo: local
2737
hooks:

CONTRIBUTING.md

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,22 @@ Before you begin, ensure you have the following installed:
2929
### Initial Setup
3030

3131
1. **Clone the repository:**
32+
3233
```bash
3334
git clone https://github.com/vllm-project/semantic-router.git
3435
cd semantic-router
3536
```
3637

3738
2. **Download required models:**
39+
3840
```bash
3941
make download-models
4042
```
43+
4144
This downloads the pre-trained classification models from Hugging Face.
4245

4346
3. **Install Python dependencies(Optional):**
47+
4448
```bash
4549
# For training and development
4650
pip install -r requirements.txt
@@ -54,30 +58,35 @@ Before you begin, ensure you have the following installed:
5458
The project consists of multiple components that need to be built in order:
5559

5660
### Build Everything
61+
5762
```bash
5863
make build
5964
```
6065

6166
### Build Individual Components
6267

6368
1. **Rust library (Candle binding):**
69+
6470
```bash
6571
make rust
6672
```
6773

6874
2. **Go router:**
75+
6976
```bash
7077
make build-router
7178
```
7279

7380
### Running the System
7481

7582
1. **Start Envoy proxy** (in one terminal):
83+
7684
```bash
7785
make run-envoy
7886
```
7987

8088
2. **Start the semantic router** (in another terminal):
89+
8190
```bash
8291
make run-router
8392
```
@@ -87,16 +96,19 @@ make build
8796
### Unit Tests
8897

8998
1. **Test Rust bindings:**
99+
90100
```bash
91101
make test-binding
92102
```
93103

94104
2. **Test Go semantic router:**
105+
95106
```bash
96107
make test-semantic-router
97108
```
98109

99110
3. **Test individual classifiers:**
111+
100112
```bash
101113
make test-category-classifier
102114
make test-pii-classifier
@@ -141,32 +153,35 @@ python e2e-tests/run_all_tests.py --check-only
141153

142154
The test suite includes:
143155

144-
+ Basic client request tests
145-
+ Envoy ExtProc interaction tests
146-
+ Router classification tests
147-
+ Semantic cache tests
148-
+ Category-specific tests
149-
+ Metrics validation tests
156+
- Basic client request tests
157+
- Envoy ExtProc interaction tests
158+
- Router classification tests
159+
- Semantic cache tests
160+
- Category-specific tests
161+
- Metrics validation tests
150162

151163
## Development Workflow
152164

153165
### Making Changes
154166

155167
1. **Create a feature branch:**
168+
156169
```bash
157170
git checkout -b feature/your-feature-name
158171
```
159172

160173
2. **Make your changes** following the project structure and coding standards.
161174

162175
3. **Build and test:**
176+
163177
```bash
164178
make clean
165179
make build
166180
make test
167181
```
168182

169183
4. **Run end-to-end tests:**
184+
170185
```bash
171186
# Start services
172187
make run-envoy &
@@ -179,6 +194,7 @@ The test suite includes:
179194
5. **Commit your changes:**
180195

181196
Commit your changes with a clear message, making sure to **sign off** on your work using the `-s` flag. This is required by the project's **Developer Certificate of Origin (DCO)**.
197+
182198
```bash
183199
git add .
184200
git commit -s -m "feat: add your feature description"
@@ -197,6 +213,7 @@ The test suite includes:
197213
Before submitting a PR, please run the pre-commit hooks to ensure code quality and consistency. **These checks are mandatory** and will be automatically run on every commit once installed.
198214

199215
**Step 1: Install pre-commit tool**
216+
200217
```bash
201218
# Using pip (recommended)
202219
pip install pre-commit
@@ -209,6 +226,7 @@ brew install pre-commit
209226
```
210227

211228
**Step 2: Install pre-commit hooks for this repository**
229+
212230
```bash
213231
# Install pre-commit hooks
214232
pre-commit install
@@ -218,6 +236,7 @@ pre-commit run --all-files
218236
```
219237

220238
### Go Code
239+
221240
- Follow standard Go formatting (`gofmt`)
222241
- Use meaningful variable and function names
223242
- Add comments for exported functions and types
@@ -228,19 +247,22 @@ pre-commit run --all-files
228247
- The CI will automatically check that `go.mod` and `go.sum` files are tidy using `make check-go-mod-tidy`
229248

230249
### Rust Code
250+
231251
- Follow Rust formatting (`cargo fmt`)
232252
- Use `cargo clippy` for linting
233253
- Handle errors appropriately with `Result` types
234254
- Document public APIs
235255

236256
### Python Code
257+
237258
- Follow PEP 8 style guidelines
238259
- Use type hints where appropriate
239260
- Write docstrings for functions and classes
240261

241262
## Submitting Changes
242263

243264
1. **Ensure all tests pass:**
265+
244266
```bash
245267
make test
246268
python e2e-tests/run_all_tests.py

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,3 +343,11 @@ docs-lint:
343343
docs-lint-fix:
344344
@echo "Fixing documentation lint issues..."
345345
cd website && npm run lint:fix
346+
347+
markdown-lint:
348+
@echo "Linting markdown files..."
349+
markdownlint -c markdownlint.yaml "**/*.md" --ignore node_modules --ignore website/node_modules
350+
351+
markdown-lint-fix:
352+
@echo "Fixing markdown lint issues..."
353+
markdownlint -c markdownlint.yaml "**/*.md" --ignore node_modules --ignore website/node_modules --fix

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@
66
[![Hugging Face](https://img.shields.io/badge/🤗%20Hugging%20Face-Community-yellow)](https://huggingface.co/LLM-Semantic-Router)
77
[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](LICENSE)
88
[![Crates.io](https://img.shields.io/crates/v/candle-semantic-router.svg)](https://crates.io/crates/candle-semantic-router)
9-
![](https://github.com/vllm-project/semantic-router/workflows/Test%20And%20Build/badge.svg)
9+
![Test And Build](https://github.com/vllm-project/semantic-router/workflows/Test%20And%20Build/badge.svg)
1010

1111
**📚 [Complete Documentation](https://vllm-semantic-router.com) | 🚀 [Quick Start](https://vllm-semantic-router.com/docs/getting-started/installation) | 📣 [Blog](https://vllm-semantic-router.com/blog/) | 📖 [API Reference](https://vllm-semantic-router.com/docs/api/router/)**
1212

13-
![](./website/static/img/code.png)
13+
![code](./website/static/img/code.png)
1414

1515
</div>
1616

1717
## Innovations ✨
1818

19-
![](./website/static/img/architecture.png)
19+
![architecture](./website/static/img/architecture.png)
2020

2121
### Intelligent Routing 🧠
2222

@@ -35,6 +35,7 @@ The screenshot below shows the LLM Router dashboard in Grafana.
3535
![LLM Router Dashboard](./website/static/img/grafana_screenshot.png)
3636

3737
The router is implemented in two ways:
38+
3839
- Golang (with Rust FFI based on the [candle](https://github.com/huggingface/candle) rust ML framework)
3940
- Python
4041
Benchmarking will be conducted to determine the best implementation.
@@ -64,6 +65,7 @@ For comprehensive documentation including detailed setup instructions, architect
6465
**👉 [Complete Documentation at Read the Docs](https://vllm-semantic-router.com/)**
6566

6667
The documentation includes:
68+
6769
- **[Installation Guide](https://vllm-semantic-router.com/docs/getting-started/installation/)** - Complete setup instructions
6870
- **[System Architecture](https://vllm-semantic-router.com/docs/architecture/system-architecture/)** - Technical deep dive
6971
- **[Model Training](https://vllm-semantic-router.com/docs/training/training-overview/)** - How classification models work
@@ -90,4 +92,4 @@ If you find Semantic Router helpful in your research or projects, please conside
9092

9193
We opened the project at Aug 31, 2025. We love open source and collaboration ❤️
9294

93-
[![Star History Chart](https://api.star-history.com/svg?repos=vllm-project/semantic-router&type=Date)](https://www.star-history.com/#vllm-project/semantic-router&Date)
95+
[![Star History Chart](https://api.star-history.com/svg?repos=vllm-project/semantic-router&type=Date)](https://www.star-history.com/#vllm-project/semantic-router&Date)

candle-binding/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,11 @@ go test -v
3333

3434
- The `-v` flag enables verbose output.
3535
- If you want to run a specific test, use:
36+
3637
```sh
3738
go test -v -run TestName
3839
```
40+
3941
Replace `TestName` with the name of the test function.
4042

4143
## Troubleshooting
@@ -46,4 +48,4 @@ go test -v
4648
## Notes
4749

4850
- The Go tests depend on the native library being present and correctly built.
49-
- Some tests may download data from the internet (e.g., from norvig.com).
51+
- Some tests may download data from the internet (e.g., from norvig.com).

deploy/kubernetes/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ The deployment consists of:
2222

2323
## Deployment
2424

25-
2625
```bash
2726
kubectl apply -k deploy/kubernetes/
2827

docker/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,25 @@ This Docker Compose configuration allows you to quickly run Semantic Router + En
1010
## Install in Docker Compose
1111

1212
1. **Clone the repository and navigate to the project directory**
13+
1314
```bash
1415
git clone <repository-url>
1516
cd semantic_router
1617
```
1718

1819
2. **Download required models** (if not already present):
20+
1921
```bash
2022
make download-models
2123
```
24+
2225
This will download the necessary ML models for classification:
2326
- Category classifier (ModernBERT-base)
2427
- PII classifier (ModernBERT-base)
2528
- Jailbreak classifier (ModernBERT-base)
2629

2730
3. **Start the services using Docker Compose**
31+
2832
```bash
2933
# Start core services (semantic-router + envoy)
3034
docker-compose up --build

e2e-tests/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,13 @@ This test suite provides a progressive approach to testing the Semantic Router,
3838
## Running Tests
3939

4040
Individual tests can be run with:
41+
4142
```
4243
python tests/XX-test-name.py
4344
```
4445

4546
Or run all tests sequentially with:
47+
4648
```
4749
cd tests && python -m pytest
4850
```
@@ -51,4 +53,4 @@ cd tests && python -m pytest
5153

5254
- Envoy must be running (make run-envoy)
5355
- Router must be running (make run-router)
54-
- Python dependencies installed
56+
- Python dependencies installed

0 commit comments

Comments
 (0)