| Crates.io | codoc |
| lib.rs | codoc |
| version | 0.1.0 |
| created_at | 2025-12-16 20:20:46.729057+00 |
| updated_at | 2025-12-16 20:20:46.729057+00 |
| description | Unified documentation parser for Ruby and TypeScript codebases |
| homepage | |
| repository | https://github.com/sudoremo/codoc |
| max_upload_size | |
| id | 1988606 |
| size | 313,754 |
A unified documentation parser for Ruby and TypeScript codebases. Extracts documentation comments (Yardoc for Ruby, JSDoc/TypeDoc for TypeScript) and outputs a common JSON format.
cargo install codoc
Or build from source:
git clone https://github.com/sudoremo/codoc
cd codoc
cargo build --release
codoc parse ./src -l ruby -n "MyProject" -o docs.json
codoc parse ./src -l typescript -n "MyProject" -o docs.json
Usage: codoc parse [OPTIONS] -l <LANGUAGE> <PATH>
Arguments:
<PATH> Source directory or file to parse
Options:
-o, --output <OUTPUT> Output file path (defaults to stdout)
-l, --language <LANGUAGE> Source language [possible values: ruby, typescript]
-n, --name <NAME> Project name [default: project]
--version <VERSION> Project version
--id-prefix <PREFIX> ID prefix for all entities
--pretty Pretty-print JSON output [default: true]
-h, --help Print help
The parser outputs JSON conforming to the codoc schema. See doc/SCHEMA.md for the full specification.
Example output structure:
{
"schema": "codoc/v1",
"metadata": {
"name": "MyProject",
"language": "ruby",
"generatedAt": "2025-01-01T00:00:00Z",
"files": ["lib/my_class.rb"]
},
"entities": [
{
"kind": "class",
"id": "MyClass",
"name": "MyClass",
"docs": {
"summary": "A sample class."
},
"methods": [...]
}
],
"symbols": [...]
}
@param - Parameter documentation@option - Hash option documentation@return - Return value documentation@raise - Exception documentation@yield, @yieldparam, @yieldreturn - Block documentation@example - Code examples@see - Cross-references@note - Important notes@todo - TODO items@deprecated - Deprecation notices@since - Version information@author - Author attribution@param - Parameter documentation@returns / @return - Return value documentation@throws / @throw - Exception documentation@example - Code examples@see - Cross-references@todo - TODO items@deprecated - Deprecation notices@since / @version - Version information@template - Type parameter documentation@private / @internal - Visibility markersYou can also use codoc as a library:
use codoc::parser::ruby::RubyParser;
use codoc::parser::{Parser, ParserConfig, ParseContext};
use codoc::schema::Language;
let mut parser = RubyParser::new()?;
let config = ParserConfig::new("MyProject", Language::Ruby);
let mut ctx = ParseContext::new(config);
let entities = parser.parse_file(&path, &content)?;
ctx.entities.extend(entities);
let document = ctx.into_document();
MIT