Skip to content

Commit a28af21

Browse files
authored
Replace CONTRIBUTING.rdoc with CONTRIBUTING.md (#1496)
1 parent 475792c commit a28af21

File tree

4 files changed

+188
-221
lines changed

4 files changed

+188
-221
lines changed

CONTRIBUTING.md

Lines changed: 186 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,186 @@
1+
# Contributing to RDoc
2+
3+
Thank you for your interest in contributing to RDoc! This document provides guidelines and instructions for contributing.
4+
5+
## Reporting Bugs
6+
7+
If you think you found a bug, open an issue on the [issue tracker](https://github.com/ruby/rdoc/issues) on GitHub.
8+
9+
When reporting a bug:
10+
11+
- Include a sample file that illustrates the problem, or link to the repository/gem associated with the bug
12+
- Include steps to reproduce the issue
13+
14+
## Development Setup
15+
16+
RDoc uses Bundler for development. To get started:
17+
18+
```bash
19+
bundle install
20+
bundle exec rake
21+
```
22+
23+
This will install dependencies and run the tests.
24+
25+
If you're working on CSS or templates, you'll also want Node dependencies for the CSS linter:
26+
27+
```bash
28+
npm install
29+
```
30+
31+
If tests don't pass on the first run, check the [GitHub Actions page](https://github.com/ruby/rdoc/actions) to see if there are any known failures.
32+
33+
**Note:** Generated parser files are committed to the repository. If you delete them (for example via `bundle exec rake clean`) or you change any `.ry`/`.kpeg` parser sources, run `bundle exec rake generate` before running tests.
34+
35+
## Running Tests
36+
37+
```bash
38+
# Run all tests (default task)
39+
bundle exec rake
40+
41+
# Run unit tests only (excludes RubyGems integration)
42+
bundle exec rake normal_test
43+
44+
# Run RubyGems integration tests only
45+
bundle exec rake rubygems_test
46+
47+
# Verify generated parser files are current (CI check)
48+
bundle exec rake verify_generated
49+
```
50+
51+
- **Test Framework:** [`test-unit`](https://github.com/test-unit/test-unit)
52+
- **Test Location:** `test/` directory
53+
- **Test Helper:** `test/lib/helper.rb`
54+
55+
## Linting
56+
57+
### RuboCop (Ruby Code)
58+
59+
```bash
60+
# Check Ruby code style
61+
bundle exec rubocop
62+
63+
# Auto-fix style issues
64+
bundle exec rubocop -A
65+
```
66+
67+
### Herb Linter (ERB/RHTML Templates)
68+
69+
```bash
70+
# Lint ERB template files
71+
npx @herb-tools/linter "**/*.rhtml"
72+
73+
# Lint specific directory
74+
npx @herb-tools/linter "lib/**/*.rhtml"
75+
```
76+
77+
**Template Location:** `lib/rdoc/generator/template/**/*.rhtml`
78+
79+
### Stylelint (CSS Files)
80+
81+
```bash
82+
# Lint CSS files
83+
npm run lint:css
84+
85+
# Auto-fix style issues
86+
npm run lint:css -- --fix
87+
```
88+
89+
## Parser Generation
90+
91+
RDoc uses generated parsers for Markdown and RD formats.
92+
93+
```bash
94+
# Generate all parser files from sources
95+
bundle exec rake generate
96+
97+
# Remove generated parser files
98+
bundle exec rake clean
99+
100+
# Verify generated files are in sync with sources (CI check)
101+
bundle exec rake verify_generated
102+
```
103+
104+
**Source Files** (edit these):
105+
106+
- `lib/rdoc/rd/block_parser.ry` → generates `block_parser.rb` via racc
107+
- `lib/rdoc/rd/inline_parser.ry` → generates `inline_parser.rb` via racc
108+
- `lib/rdoc/markdown.kpeg` → generates `markdown.rb` via kpeg
109+
- `lib/rdoc/markdown/literals.kpeg` → generates `literals.rb` via kpeg
110+
111+
**Important:**
112+
113+
- Generated parser files **should be committed** to the repository
114+
- Do not edit generated `.rb` parser files directly
115+
- After modifying `.ry` or `.kpeg` source files, run `bundle exec rake generate`
116+
- CI runs `rake verify_generated` to ensure generated files are in sync with their sources
117+
118+
## Documentation Generation
119+
120+
```bash
121+
# Generate documentation (creates _site directory)
122+
bundle exec rake rdoc
123+
124+
# Force regenerate documentation
125+
bundle exec rake rerdoc
126+
127+
# Show documentation coverage
128+
bundle exec rake rdoc:coverage
129+
bundle exec rake coverage
130+
```
131+
132+
- **Output Directory:** `_site/` (GitHub Pages compatible)
133+
- **Configuration:** `.rdoc_options` and `.document`
134+
135+
## Themes
136+
137+
RDoc ships with two HTML themes:
138+
139+
- **Aliki** - Modern theme with improved styling and navigation (will become the default)
140+
- **Darkfish** - Classic theme (entering maintenance mode)
141+
142+
New feature development should focus on the Aliki theme. Darkfish will continue to receive bug fixes but no new features.
143+
144+
Theme templates are located at `lib/rdoc/generator/template/<theme>/`.
145+
146+
## Project Structure
147+
148+
```
149+
lib/rdoc/
150+
├── rdoc.rb # Main entry point (RDoc::RDoc class)
151+
├── version.rb # Version constant
152+
├── task.rb # Rake task integration
153+
├── parser/ # Source code parsers
154+
│ ├── ruby.rb # Ruby code parser
155+
│ ├── c.rb # C extension parser
156+
│ ├── prism_ruby.rb # Prism-based Ruby parser
157+
│ └── ...
158+
├── generator/ # Documentation generators
159+
│ ├── darkfish.rb # HTML generator (default theme)
160+
│ ├── markup.rb # Markup format generator
161+
│ ├── ri.rb # RI command generator
162+
│ └── template/ # ERB templates
163+
│ ├── darkfish/ # Darkfish theme (maintenance mode)
164+
│ └── aliki/ # Aliki theme (active development)
165+
├── markup/ # Markup parsing and formatting
166+
├── code_object/ # AST objects for documented items
167+
├── markdown.kpeg # Parser source (edit this)
168+
├── markdown.rb # Generated parser (do not edit)
169+
├── markdown/ # Markdown parsing
170+
│ ├── literals.kpeg # Parser source (edit this)
171+
│ └── literals.rb # Generated parser (do not edit)
172+
├── rd/ # RD format parsing
173+
│ ├── block_parser.ry # Parser source (edit this)
174+
│ ├── block_parser.rb # Generated parser (do not edit)
175+
│ ├── inline_parser.ry # Parser source (edit this)
176+
│ └── inline_parser.rb # Generated parser (do not edit)
177+
└── ri/ # RI (Ruby Info) tool
178+
179+
test/ # Test files
180+
├── lib/helper.rb # Test helpers
181+
└── rdoc/ # Main test directory
182+
```
183+
184+
## Code of Conduct
185+
186+
Please be respectful and constructive in all interactions. We're all here to make RDoc better!

0 commit comments

Comments
 (0)