Complete reference documentation for quick lookups.

1. Overview

This section provides comprehensive reference material for all Canon options, methods, and concepts. Use this section when you need to:

  • Look up specific CLI options

  • Find complete API method signatures

  • Understand all match dimensions

  • Check environment variable names

  • Reference technical terms

2. Reference Pages

CLI Options Reference

Complete listing of all command-line options for format and diff commands.

Organized by category with examples for each option.

Ruby API Methods Reference

Complete API documentation for all public methods.

Includes signatures, parameters, return values, and examples.

Match Dimensions Reference

All available match dimensions with descriptions and valid values.

Organized by format (XML/HTML, JSON/YAML) with examples.

Environment Variables Reference

All environment variables that configure Canon’s behavior.

Includes variable names, types, defaults, and examples.

Glossary

Definitions of technical terms used throughout Canon documentation.

Alphabetically organized with cross-references.

3. Quick Lookup Tables

3.1. Match Profiles

Profile Description

strict

Exact matching - all dimensions strict

rendered

Browser/CSS rendering simulation

spec_friendly

Test-friendly - ignores formatting

content_only

Ignores all structural differences

See Match Dimensions: Profiles for detailed dimension settings.

3.2. Diff Algorithms

Algorithm Strength Best For

dom

Fast, stable

Similar documents

semantic

Intelligent, move detection

Restructured documents

See Comparison Algorithms for details.

3.3. Diff Modes

Mode Description

by_line

Traditional line-by-line diff output

by_object

Tree-based semantic diff output

See Diff Modes for details.

3.4. Supported Formats

Format Canonicalization Default Diff Mode

XML

W3C C14N 1.1

by_object

HTML

HTML4/5 specific

by_line

JSON

Sorted keys

by_object

YAML

Sorted keys

by_object

See Format Support for details.

4. Common Lookups

4.1. CLI Command Structure

# Format command
canon format <file> [options]

# Diff command
canon diff <file1> <file2> [options]

See CLI Options Reference for all options.

4.2. Ruby API Patterns

# Formatting
Canon.format(input, format, **options)

# Comparison
Canon::Comparison.equivalent?(doc1, doc2, **options)
Canon::Comparison.compare(doc1, doc2, **options)

# RSpec matchers
expect(actual).to be_xml_equivalent_to(expected)
expect(actual).to match_xml(expected, **options)

See Ruby API Reference for complete signatures.

4.3. Environment Variables

# Size limits
export CANON_MAX_FILE_SIZE=5242880  # 5MB
export CANON_MAX_NODES=10000

# Diff configuration
export CANON_DIFF_CONTEXT_LINES=5
export CANON_DIFF_GROUPING_LINES=3

# Debug
export CANON_DEBUG=true

See Environment Variables Reference for all variables.

5. Using This Section

To find a specific option

Use your browser’s search (Ctrl+F / Cmd+F) or check the CLI Options or Ruby API references.

To understand a term

Check the Glossary for definitions and cross-references.

To see all match dimensions

Review Match Dimensions Reference for complete listings.

To configure via environment

See Environment Variables Reference for all ENV options.

6. Next Steps

  • Browse specific reference pages for detailed information

  • Use the search function to find specific topics

  • Refer to Interfaces for usage examples

  • Check Guides for task-oriented tutorials

7. See Also


Table of contents