The ceradoc command-line interface provides document conversion and processing capabilities.

Installation

gem install ceradoc

Verify installation:

ceradoc version
# => ceradoc 1.0.0

Global Options

These options apply to all commands:

--verbose, -v

Enable verbose output

--quiet, -q

Suppress non-essential output

--config FILE

Path to configuration file (default: .ceradoc.yml)

--help, -h

Show help message

--version

Show version information

Commands

convert

Convert documents between formats.

Syntax
ceradoc convert INPUT [OPTIONS]
Arguments
INPUT

Input file path (required)

Options
--output, -o FILE

Output file path (default: stdout)

--from, -f FORMAT

Source format (auto-detected from extension)

--to, -t FORMAT

Target format (required unless output extension specified)

--theme THEME

HTML theme (classic, modern, minimal)

--validate

Validate document before conversion

--strip-comments

Remove comments from output

--preserve-ids

Preserve element IDs during conversion

--base-dir DIR

Base directory for include resolution

Supported Formats
asciidoc, adoc

AsciiDoc format

markdown, md

CommonMark Markdown

html

HTML5

docx

Microsoft Word DOCX (requires ceradoc-docx gem)

Examples
# Convert Markdown to HTML (output to stdout)
ceradoc convert document.md

# Convert to specific output file
ceradoc convert document.md -o output.html

# Convert AsciiDoc to Markdown
ceradoc convert input.adoc --to markdown -o output.md

# Convert DOCX to AsciiDoc (requires ceradoc-docx gem)
ceradoc convert document.docx -o output.adoc

# Convert DOCX to Markdown
ceradoc convert document.docx -o output.md

# Auto-detect output format from extension
ceradoc convert input.md -o output.adoc

# Convert with modern HTML theme
ceradoc convert input.adoc -o output.html --theme modern

# Convert with validation
ceradoc convert important.adoc -o output.html --validate

# Verbose output
ceradoc convert document.md -o output.html --verbose
Exit Codes
0

Success

1

General error (file not found, parse error, etc.)

2

Validation error

3

Unsupported format


parse

Parse a document and output the document structure.

Syntax
ceradoc parse INPUT [OPTIONS]
Arguments
INPUT

Input file path (required)

Options
--format, -f FORMAT

Source format (auto-detected)

--output, -o FILE

Output file for structure dump

--json

Output as JSON

--yaml

Output as YAML

--show-model

Show CoreModel structure

--show-ast

Show parse tree (AST)

Examples
# Parse and show document structure
ceradoc parse document.adoc

# Parse and output as JSON
ceradoc parse document.md --json -o structure.json

# Show CoreModel representation
ceradoc parse input.adoc --show-model

# Show raw AST
ceradoc parse input.md --show-ast

formats

List supported formats and their capabilities.

Syntax
ceradoc formats [OPTIONS]
Options
--json

Output as JSON

--detailed

Show detailed feature support

Examples
# List supported formats
ceradoc formats

# Detailed feature matrix
ceradoc formats --detailed

# JSON output for scripting
ceradoc formats --json
Output Format
Supported Formats:
  asciidoc (.adoc, .asciidoc)
    - Parse: ✓
    - Serialize: ✓
    - Features: tables, lists, blocks, continuation

  markdown (.md, .markdown)
    - Parse: ✓
    - Serialize: ✓
    - Features: tables, lists, code blocks

  html (.html, .htm)
    - Parse: ✓
    - Serialize: ✓
    - Features: semantic HTML, tables

validate

Validate a document against its format specification.

Syntax
ceradoc validate INPUT [OPTIONS]
Arguments
INPUT

Input file path (required)

Options
--format, -f FORMAT

Source format (auto-detected)

--schema FILE

Custom validation schema

--strict

Enable strict validation

--warnings

Treat warnings as errors

Examples
# Validate a document
ceradoc validate document.adoc

# Validate with strict mode
ceradoc validate important.adoc --strict

# Validate with custom schema
ceradoc validate custom.xml --schema schemas/custom.yml
Exit Codes
0

Valid

1

Invalid (errors found)

2

Schema error


version

Show version information.

Syntax
ceradoc version [OPTIONS]
Options
--short

Show version number only

--all

Show all component versions

Examples
# Full version info
ceradoc version
# => ceradoc 1.0.0
# => ceradoc-adoc 1.0.0
# => ceradoc-html 1.0.0
# => ceradoc-markdown 1.0.0

# Short version
ceradoc version --short
# => 1.0.0

Configuration File

Create .ceradoc.yml in your project directory:

# Default format settings
defaults:
  input_format: asciidoc
  output_format: html

# HTML output settings
html:
  theme: modern
  embed_css: true
  syntax_highlight: true

# Validation settings
validation:
  strict: true
  warnings_as_errors: false

# Include path resolution
includes:
  base_dir: .
  allow_url_includes: false

Environment Variables

CERADOC_CONFIG

Path to configuration file

CERADOC_THEME

Default HTML theme

CERADOC_VERBOSE

Enable verbose mode (1 or 0)

CERADOC_FORMAT

Default output format

Example
export CERADOC_THEME=modern
export CERADOC_VERBOSE=1
ceradoc convert document.adoc -o output.html

Shell Integration

Bash Completion

Add to ~/.bashrc:

eval "$(ceradoc completion bash)"

Zsh Completion

Add to ~/.zshrc:

eval "$(ceradoc completion zsh)"

CI/CD Integration

GitHub Actions

name: Convert Docs
on: [push]

jobs:
  convert:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: ruby/setup-ruby@v1
        with:
          ruby-version: '3.3'
      - run: gem install ceradoc
      - run: |
          for f in docs/*.adoc; do
            ceradoc convert "$f" -o "build/${f%.adoc}.html"
          done
      - uses: actions/upload-artifact@v4
        with:
          name: html-docs
          path: build/

GitLab CI

convert-docs:
  image: ruby:3.3
  script:
    - gem install ceradoc
    - mkdir -p build
    - find docs -name '*.adoc' -exec sh -c
        'ceradoc convert "$1" -o "build/$(basename "${1%.adoc}").html"' _ {} \;
  artifacts:
    paths:
      - build/

Makefile

.SUFFIXES: .adoc .html .md

ADOC_FILES := $(wildcard docs/*.adoc)
HTML_FILES := $(patsubst %.adoc,build/%.html,$(ADOC_FILES))

all: $(HTML_FILES)

build/%.html: docs/%.adoc
	@mkdir -p build
	ceradoc convert $< -o $@

clean:
	rm -rf build/

.PHONY: all clean

Troubleshooting

Common Errors

File Not Found
Error: File not found: document.adoc

Check file path and current directory.

Unsupported Format
Error: Unsupported format: .xyz

Use ceradoc formats to see supported formats.

Parse Error
Parse error at line 42, column 15:
  |=== invalid table
              ^

Check syntax in the input file.

Validation Error
Validation error: Missing required attribute 'title'

Fix the document or use --no-validate to skip validation.

Debugging

Use --verbose for detailed output:

ceradoc convert input.adoc -o output.html --verbose

Check document structure:

ceradoc parse input.adoc --show-model

Getting Help

# General help
ceradoc --help

# Command-specific help
ceradoc convert --help
ceradoc parse --help

# Version info
ceradoc version --all

This site uses Just the Docs, a documentation theme for Jekyll.