docs(footnotes): document parse_definition and is_definition_continuation (#367) - #413
Conversation
Add `///` doc comments to `parse_definition` and `is_definition_continuation` in `src/footnotes/parsing.rs`, describing their inputs, return values, and the definition/continuation grammar they encode. These `pub(super)` helpers form the footnotes module's parsing interface, consumed across the renumber and lists submodules, and now carry a documented contract. Closes #367 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 29 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 71f61d0bff
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| /// Parses a footnote definition line into its constituent [`DefinitionParts`]. | ||
| /// | ||
| /// A definition matches [`DEF_RE`]: an optional blockquote prefix (`>` | ||
| /// markers with surrounding whitespace), a `[^N]:` marker bearing a decimal | ||
| /// footnote number, and the trailing text following the colon. The borrowed | ||
| /// `prefix` and `rest` fields point into `line`. | ||
| /// | ||
| /// Returns [`None`] when `line` is not a definition, or when the captured | ||
| /// number does not parse as a [`usize`]. |
There was a problem hiding this comment.
Add an input/output example for
parse_definition
This new function documentation describes the grammar but never provides an example showing how a representative definition is parsed into prefix, number, and rest, or how invalid input yields None. Add a concise usage-and-outcome example as required for all function documentation.
AGENTS.md reference: AGENTS.md:L27-L30
Useful? React with 👍 / 👎.
| /// Reports whether `line` continues the preceding footnote definition. | ||
| /// | ||
| /// A continuation is any line whose first character is whitespace, marking | ||
| /// indented body text that belongs to the definition above it rather than | ||
| /// beginning a new construct. An empty `line` has no leading character and so | ||
| /// returns `false`. |
There was a problem hiding this comment.
Add an input/output example for continuation detection
This new function documentation does not include an example demonstrating which inputs return true or false; in particular, an indented line and an empty or unindented line would make the whitespace-based contract immediately clear. Add a concise usage-and-outcome example as required for all function documentation.
AGENTS.md reference: AGENTS.md:L27-L30
Useful? React with 👍 / 👎.
Address review feedback: per the AGENTS.md convention that function documentation include a clear usage-and-outcome example, add `# Examples` sections to `parse_definition` and `is_definition_continuation`. The examples use `text` code blocks (these `pub(super)` helpers are not part of the public doctest surface) and show representative inputs alongside their outcomes, making the whitespace and marker contracts immediate. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Summary
Add
///doc comments to the twopub(super)entry points of the footnotesparsing module in
src/footnotes/parsing.rs:parse_definition— documents that it parses a footnote definition lineinto
DefinitionParts(matchingDEF_RE: optional blockquote prefix,[^N]:marker with a decimal number, and trailing text), that
prefix/restborrowfrom the input, and that it returns
Nonewhen the line is not a definitionor the number does not parse as a
usize.is_definition_continuation— documents that a continuation is any linewhose first character is whitespace (indented body text belonging to the
definition above), and that an empty line returns
false.These helpers form the module's parsing interface, consumed across the
renumberandlistssubmodules, and previously carried no documentedcontract for their inputs, outputs, or the grammar they encode.
Comments use en-GB Oxford spelling.
Closes #367
Acceptance criteria
///doc comments stating inputs and outputs.makelint/doc gates pass (fmt, clippy, typecheck, test, markdownlint, nixie all green).References
🤖 Generated with Claude Code