Contributing to RDoc
Thank you for your interest in contributing to RDoc! This document provides guidelines and instructions for contributing.
Reporting Bugs
If you think you found a bug, open an issue on the issue tracker on GitHub.
When reporting a bug:
-
Include a sample file that illustrates the problem, or link to the repository/gem associated with the bug
-
Include steps to reproduce the issue
Development Setup
RDoc uses Bundler for development. To get started:
bundle install bundle exec rake
This will install dependencies and run the tests.
If youβre working on CSS or templates, youβll also want Node dependencies for the CSS linter:
npm install
If tests donβt pass on the first run, check the GitHub Actions page to see if there are any known failures.
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.
Running Tests
# Run all tests (default task) bundle exec rake # Run unit tests only (excludes RubyGems integration) bundle exec rake normal_test # Run RubyGems integration tests only bundle exec rake rubygems_test # Verify generated parser files are current (CI check) bundle exec rake verify_generated
-
Test Framework:
test-unit -
Test Location:
test/directory -
Test Helper:
test/lib/helper.rb
Linting
RuboCop (Ruby Code)
# Check Ruby code style bundle exec rubocop # Auto-fix style issues bundle exec rubocop -A
Herb Linter (ERB/RHTML Templates)
# Lint ERB template files npx @herb-tools/linter "**/*.rhtml" # Lint specific directory npx @herb-tools/linter "lib/**/*.rhtml"
Template Location: lib/rdoc/generator/template/*/.rhtml
Stylelint (CSS Files)
# Lint CSS files npm run lint:css # Auto-fix style issues npm run lint:css -- --fix
Parser Generation
RDoc uses generated parsers for Markdown and RD formats.
# Generate all parser files from sources bundle exec rake generate # Remove generated parser files bundle exec rake clean # Verify generated files are in sync with sources (CI check) bundle exec rake verify_generated
Source Files (edit these):
-
lib/rdoc/rd/block_parser.ryβ generatesblock_parser.rbvia racc -
lib/rdoc/rd/inline_parser.ryβ generatesinline_parser.rbvia racc -
lib/rdoc/markdown.kpegβ generates markdown.rb via kpeg -
lib/rdoc/markdown/literals.kpegβ generates literals.rb via kpeg
Important:
-
Generated parser files should be committed to the repository
-
Do not edit generated
.rbparser files directly -
After modifying
.ryor.kpegsource files, runbundle exec rake generate -
CI runs
rake verify_generatedto ensure generated files are in sync with their sources
Documentation Generation
# Generate documentation (creates _site directory) bundle exec rake rdoc # Force regenerate documentation bundle exec rake rerdoc # Show documentation coverage bundle exec rake rdoc:coverage bundle exec rake coverage
-
Output Directory:
_site/(GitHub Pages compatible) -
Configuration:
.rdoc_optionsand.document
Themes
RDoc ships with two HTML themes:
-
Aliki - Modern theme with improved styling and navigation (will become the default)
-
Darkfish - Classic theme (entering maintenance mode)
New feature development should focus on the Aliki theme. Darkfish will continue to receive bug fixes but no new features.
Theme templates are located at lib/rdoc/generator/template/<theme>/.
Project Structure
lib/rdoc/ βββ rdoc.rb # Main entry point (RDoc::RDoc class) βββ version.rb # Version constant βββ task.rb # Rake task integration βββ parser/ # Source code parsers β βββ ruby.rb # Ruby code parser β βββ c.rb # C extension parser β βββ prism_ruby.rb # Prism-based Ruby parser β βββ ... βββ generator/ # Documentation generators β βββ darkfish.rb # HTML generator (default theme) β βββ markup.rb # Markup format generator β βββ ri.rb # RI command generator β βββ template/ # ERB templates β βββ darkfish/ # Darkfish theme (maintenance mode) β βββ aliki/ # Aliki theme (active development) βββ markup/ # Markup parsing and formatting βββ code_object/ # AST objects for documented items βββ markdown.kpeg # Parser source (edit this) βββ markdown.rb # Generated parser (do not edit) βββ markdown/ # Markdown parsing β βββ literals.kpeg # Parser source (edit this) β βββ literals.rb # Generated parser (do not edit) βββ rd/ # RD format parsing β βββ block_parser.ry # Parser source (edit this) β βββ block_parser.rb # Generated parser (do not edit) β βββ inline_parser.ry # Parser source (edit this) β βββ inline_parser.rb # Generated parser (do not edit) βββ ri/ # RI (Ruby Info) tool test/ # Test files βββ lib/helper.rb # Test helpers βββ rdoc/ # Main test directory
Code of Conduct
Please be respectful and constructive in all interactions. Weβre all here to make RDoc better!