Skip to content

Commit fac55e1

Browse files
committed
Merge commit '268f15fe002ecfab2469da87e979c7c26d56595a' as 'docs'
2 parents 1c22c6f + 268f15f commit fac55e1

File tree

1,111 files changed

+271376
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,111 files changed

+271376
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
## Documentation Pull Request
2+
3+
### Summary
4+
<!-- Briefly describe what documentation changes are included in this PR -->
5+
6+
### Type of Change
7+
<!-- Check all that apply -->
8+
- [ ] New documentation
9+
- [ ] Documentation update/revision
10+
- [ ] Fix typos or grammar
11+
- [ ] Restructure/reorganize content
12+
- [ ] Add examples or tutorials
13+
- [ ] Update API documentation
14+
- [ ] Other: ___________
15+
16+
### Related Issues
17+
<!-- Link any related issues -->
18+
Fixes #
19+
Relates to #
20+
21+
### Checklist
22+
- [ ] Build succeeds locally with `pnpm run build`
23+
- [ ] Lint is successful when running `pnpm run check`
24+
- [ ] Docs follow [OpenZeppelin Documentation Standards](https://github.com/OpenZeppelin/docs/blob/main/STANDARDS.md)
25+
26+
### Additional Notes
27+
<!-- Any additional context, concerns, or information for reviewers -->

docs/.github/workflows/lint.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Lint & Format
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
env:
10+
NEXT_TELEMETRY_DISABLED: 1
11+
12+
jobs:
13+
lint:
14+
name: Lint and Format Check
15+
runs-on: ubuntu-latest
16+
strategy:
17+
matrix:
18+
node-version: [22]
19+
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v5
23+
24+
- name: Setup pnpm
25+
uses: pnpm/action-setup@v4
26+
27+
- name: Use Node.js ${{ matrix.node-version }}
28+
uses: actions/setup-node@v5
29+
with:
30+
node-version: ${{ matrix.node-version }}
31+
cache: "pnpm"
32+
33+
- name: Install dependencies
34+
run: pnpm install --frozen-lockfile
35+
36+
- name: Run lint and format checks
37+
run: pnpm run check
38+
39+
- name: Build check
40+
run: pnpm run build
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Sync Search Content
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
jobs:
8+
sync-search:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout repository
13+
uses: actions/checkout@v4
14+
15+
- name: Setup Bun
16+
uses: oven-sh/setup-bun@v2
17+
with:
18+
bun-version: latest
19+
20+
- name: Install dependencies
21+
run: bun install
22+
23+
- name: Run sync search content
24+
run: bun run scripts/sync-search-content.ts
25+
env:
26+
NEXT_PUBLIC_ALGOLIA_ID: ${{ secrets.NEXT_PUBLIC_ALGOLIA_ID }}
27+
ALGOLIA_PRIVATE_KEY: ${{ secrets.ALGOLIA_PRIVATE_KEY }}

docs/.gitignore

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# deps
2+
/node_modules
3+
4+
# generated content
5+
.contentlayer
6+
.content-collections
7+
.source
8+
9+
# test & build
10+
/coverage
11+
/.next/
12+
/out/
13+
/build
14+
*.tsbuildinfo
15+
16+
# misc
17+
.DS_Store
18+
*.pem
19+
/.pnp
20+
.pnp.js
21+
npm-debug.log*
22+
yarn-debug.log*
23+
yarn-error.log*
24+
25+
# others
26+
.env*.local
27+
.vercel
28+
next-env.d.ts
29+
old-docs
30+
.claude
31+
TODO.md
32+
broken-links.md
33+
34+
# Local Netlify folder
35+
.netlify

docs/AGENTS.md

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
# AGENTS.md - OpenZeppelin Docs Codebase Guide
2+
3+
## Build/Lint/Test Commands
4+
- `pnpm run build` - Build the Next.js application
5+
- `pnpm run dev` - Start development server with turbo
6+
- `pnpm run start` - Start production server
7+
- `pnpm run postinstall` - Process MDX files with fumadocs-mdx
8+
- `pnpm run lint` - Lint code with Biome
9+
- `pnpm run lint:fix` - Lint and auto-fix issues with Biome
10+
- `pnpm run format` - Check code formatting with Biome
11+
- `pnpm run format:fix` - Format code with Biome
12+
- `pnpm run check` - Run both linting and formatting checks
13+
- `pnpm run check:fix` - Run both linting and formatting with auto-fix
14+
- No test commands configured - this is a documentation site
15+
16+
## Navigation Management
17+
The site uses a **modular JSON navigation system** instead of fumadocs meta.json files:
18+
19+
### Navigation Structure
20+
- `src/navigation/` - Modular navigation configuration
21+
- `types.ts` - TypeScript interfaces for navigation
22+
- `contracts.json` - All contract-related navigation
23+
- `tools.json` - Tools section navigation
24+
- `ecosystems.json` - Ecosystem-specific sections
25+
- `index.ts` - Combines all sections into navigationTree
26+
27+
### Editing Navigation
28+
- **Add new pages**: Edit the relevant JSON file (contracts/tools/ecosystems)
29+
- **Reorder sections**: Modify array order in respective JSON files
30+
- **Add new sections**: Create new JSON file and import in `index.ts`
31+
- **Do NOT use meta.json files** - they have been removed and are not supported
32+
33+
## Code Style Guidelines
34+
35+
### TypeScript/JavaScript
36+
- Use TypeScript strict mode (enabled in tsconfig.json)
37+
- Prefer named imports: `import { RootProvider } from 'fumadocs-ui/provider'`
38+
- Use path aliases: `@/*` for src/, `@/.source` for .source/
39+
- Function components with explicit return types when needed
40+
- Use React 19+ features and patterns
41+
42+
### File Structure
43+
- Source files in `src/` directory
44+
- Documentation content in `content/` with nested version folders (v2.x, v3.x, etc.)
45+
- Examples in `examples/` directory organized by feature
46+
- Public assets in `public/` directory
47+
- Navigation config in `src/navigation/` directory
48+
49+
### Naming Conventions
50+
- PascalCase for React components and interfaces
51+
- camelCase for variables and functions
52+
- kebab-case for file names in content directories
53+
54+
## Markdown Link Cleanup Strategy
55+
56+
### Problem
57+
Legacy markdown files often contain complex, unreadable link syntax that creates URL-encoded URLs like:
58+
```
59+
http://localhost:3000/api/access#has_role(role:-felt252,-account:-contractaddress)-%E2%86%92-bool-external
60+
```
61+
62+
### Solution Approach
63+
When cleaning up markdown files with complex link syntax, follow this systematic approach:
64+
65+
#### 1. Identify Complex Link Patterns
66+
Look for these problematic patterns:
67+
- **Function list links**: `[`+function_name+`](#`[.contract-item-name]#`function_name`#`(params)``-[.item-kind]#external#)`
68+
- **Event list links**: `[`+EventName+`](#`[.contract-item-name]#`eventname`#`(params)``-[.item-kind]#event#)`
69+
- **Function headings**: `#### `[.contract-item-name]#`function_name`#`(params)`` [.item-kind]#external#`
70+
71+
#### 2. Create Clean Link Strategy
72+
Replace with simple, readable format:
73+
- **Clean list links**: `[`function_name`](#prefix-function_name)`
74+
- **Clean headings with anchors**:
75+
```markdown
76+
<a id="prefix-function_name"></a>
77+
#### `function_name(params) → return_type`
78+
```
79+
80+
#### 3. Anchor ID Naming Convention
81+
Use descriptive prefixes to avoid conflicts:
82+
- `iaccesscontrol-` for interface functions/events
83+
- `component-` for component functions/events
84+
- `extension-` for extension functions/events
85+
86+
#### 4. Implementation Process
87+
1. **Use Task agent** for systematic fixes across large files
88+
2. **Fix by section** - group related functions/events together
89+
3. **Update both links and targets** - ensure table of contents links point to correct anchors
90+
4. **Verify no complex patterns remain** - search for `[.contract-item-name]#` and `[.item-kind]#`
91+
92+
#### 5. Benefits
93+
- ✅ Clean, readable URLs
94+
- ✅ Better SEO and user experience
95+
- ✅ Easier maintenance and debugging
96+
- ✅ Consistent markdown formatting
97+
98+
### Example Before/After
99+
100+
**Before (Complex):**
101+
```markdown
102+
* [`+has_role(role, account)+`](#`[.contract-item-name]#`has_role`#`(role:-felt252,-account:-contractaddress)-→-bool``-[.item-kind]#external#)
103+
104+
#### `[.contract-item-name]#`has_role`#`(role: felt252, account: ContractAddress) → bool`` [.item-kind]#external#
105+
```
106+
107+
**After (Clean):**
108+
```markdown
109+
* [`has_role(role, account)`](#iaccesscontrol-has_role)
110+
111+
<a id="iaccesscontrol-has_role"></a>
112+
#### `has_role(role: felt252, account: ContractAddress) → bool`
113+
```
114+
115+
### Framework Compatibility Notes
116+
- **DO NOT use `{#anchor}` syntax** - breaks the framework parser
117+
- **USE HTML anchor tags** - `<a id="anchor-name"></a>` format is safe
118+
- **Test locally** to ensure links work properly after changes

docs/CONTRIBUTING.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Contributing
2+
3+
Thank you for your interest in contributing to the OpenZeppelin Docs! We welcome contributions from everyone.
4+
5+
## How to Contribute
6+
7+
Please follow this guide if you have something to contribute.
8+
9+
### Reporting Issues
10+
11+
If you find a bug or have a suggestion for improvement:
12+
13+
1. Check if the issue already exists in [GitHub issues](https://github.com/OpenZeppelin/docs/issues)
14+
2. If not, create a new issue with a clear description
15+
3. Wait for a team member to comment before moving forward with a pull request
16+
17+
### Making Changes
18+
19+
1. Fork the repository
20+
2. Create a new branch for your change
21+
3. Follow the local development guide in the [README](README.md) or with the steps [below](#development-setup)
22+
4. Use [conventional commits](https://www.conventionalcommits.org/) when making changes
23+
5. Make sure your changes follow the [OpenZeppelin Docs Standards](STANDARDS.md)
24+
6. Submit a pull request
25+
26+
### Pull Request Guidelines
27+
28+
- Keep pull requests focused on a single feature or fix
29+
- Write clear commit messages
30+
- Spelling fixes should be grouped as much as possible (i.e. fixing multiple errors instead of just one)
31+
32+
### Development Setup
33+
34+
1. Make sure [pnpm](https://pnpm.io) is installed
35+
36+
```bash
37+
pnpm --version
38+
```
39+
40+
2. Clone the repo and install dependencies
41+
42+
```bash
43+
git clone https://github.com/OpenZeppelin/docs
44+
cd docs
45+
pnpm install
46+
```
47+
48+
3. Run the `dev` server to see a live preview and have your changes reflected at `http://localhost:3000`
49+
50+
```bash
51+
pnpm dev
52+
```
53+
54+
4. After making changes run the lint command to make formatting rules are applied
55+
56+
```bash
57+
pnpm run check:fix
58+
```
59+
60+
## Code of Conduct
61+
62+
Please be respectful and constructive in all interactions. We strive to maintain a welcoming and inclusive environment for all contributors.
63+
64+
## Questions?
65+
66+
If you have questions about contributing, feel free to open an issue or reach out to the maintainers.

0 commit comments

Comments
 (0)