nixdoc
A spec-based parser for Nixdoc documentation comments (RFC145).
Nixdoc uses /** … */ doc comments containing Markdown with structured
sections introduced by level-1 headings (# Section). This crate parses
that format into a typed [DocComment] structure, extracting the
description, type signature, arguments, examples, and any other sections.
Quick start
use DocComment;
// Simple one-liner:
let doc = parse.unwrap;
assert_eq!;
assert!;
use DocComment;
// Multi-section comment (without inner code fences for this example):
let doc = parse.unwrap;
assert_eq!;
let args = doc.arguments;
assert_eq!;
assert_eq!;
assert_eq!;
Comment format
A Nixdoc comment starts with /** and ends with */. Content is indented
(typically by two spaces) and the indentation is automatically stripped.
Sections are introduced by level-1 Markdown headings (# Section). The
section body is Markdown text and may contain fenced code blocks.
Recognised section headings (case-insensitive):
Type, Arguments/Args, Example, Examples, Note, Notes,
Warning/Warnings/Caution, Deprecated.