man_parser 0.1.0

A Rust roff parser for converting man pages to JSON/Markdown
Documentation
  • Coverage
  • 40%
    2 out of 5 items documented0 out of 4 items with examples
  • Size
  • Source code size: 58.4 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.59 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 23s Average build duration of successful builds.
  • all releases: 23s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • edwinjhlee

man_parser

A Rust parser for roff (man page) files, supporting conversion to JSON and Markdown.

Features

  • tojson: Convert roff/man files to JSON
  • tomd: Convert roff/man files to Markdown
  • bench: Benchmark parser performance on manpath files

Installation

cargo install --path .

Usage

# Convert to JSON
roff tojson file.1

# Pretty-print JSON
roff tojson --pretty file.1

# Convert to Markdown
roff tomd file.1

# Read from stdin
roff tojson -- < file.1
roff tomd -- < file.1

# Benchmark
roff bench                # process first 10 files
roff bench --count 100    # process first 100 files
roff bench --all          # process all manpath files

Library Usage

use man_parser::{parse_roff, to_json, to_markdown};

let input = ".TH TEST 1\n.SH NAME\ntest \\- a test program";
let roff = parse_roff(input);

let json = to_json(&roff);
let md = to_markdown(&roff);

License

Apache-2.0