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:

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

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):

Important:

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

Themes

RDoc ships with two HTML themes:

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!