Conversation
Reviewer's GuideThis PR enhances the footnote conversion logic to recognize and process colon-separated references by introducing a new regex and updating conversion flow, extends definition parsing, adds corresponding tests, and updates documentation accordingly. Class diagram for updated footnote conversion logicclassDiagram
class FootnoteConverter {
+convert_inline(text: &str) String
-INLINE_FN_RE: Regex
-COLON_FN_RE: Regex // NEW: Handles colon-separated footnotes
-FOOTNOTE_LINE_RE: Regex // MODIFIED: Now matches both '.' and ':'
-build_footnote(...)
-capture_parts(...)
}
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. Summary by CodeRabbit
WalkthroughExpand footnote handling to support numeric references followed by a colon in both inline and definition contexts. Update the regular expressions and conversion logic to recognise this new pattern. Add corresponding documentation and tests to reflect and verify the extended functionality. No public API changes are introduced. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Converter
participant RegexEngine
User->>Converter: Submit markdown with numeric footnote references (incl. colon pattern)
Converter->>RegexEngine: Match inline footnote patterns
RegexEngine-->>Converter: Return matches (dot, colon, etc.)
Converter->>RegexEngine: Match colon-style footnote references
RegexEngine-->>Converter: Return colon matches
Converter->>User: Return markdown with converted footnote references
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (1)**/*.rs⚙️ CodeRabbit Configuration File
Files:
🔇 Additional comments (3)
✨ Finishing Touches
🧪 Generate unit tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 2
♻️ Duplicate comments (1)
tests/footnotes.rs (1)
87-100: Add edge-case coverage and parameterise with rstest.Add cases for:
- Multiple trailing colons (e.g., “12::”).
- Colon followed by punctuation (e.g., “8:;”).
- Extra whitespace before/after the colon (e.g., “ 9 : ”).
- Styled markers before numbers (e.g., “_7:” or “*7:”).
Prefer
rstestto reduce duplication.Example:
use rstest::rstest; #[rstest( input, expected, case(lines_vec!("This is a reference 12:: to something important."), lines_vec!("This is a reference[^12]:: to something important.")), case(lines_vec!("Another case is 8:; for completeness."), lines_vec!("Another case is[^8]:; for completeness.")), case(lines_vec!("This is a tricky one 9 : and should be handled."), lines_vec!("This is a tricky one[^9]: and should be handled.")), case(lines_vec!("Styled footnote _7: appears here."), lines_vec!("Styled footnote _[^7]: appears here.")), )] fn converts_colon_variants(input: Vec<String>, expected: Vec<String>) { assert_eq!(convert_footnotes(&input), expected); }Also applies to: 102-107
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (3)
docs/architecture.md(2 hunks)src/footnotes.rs(2 hunks)tests/footnotes.rs(1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
docs/**/*.md
📄 CodeRabbit Inference Engine (AGENTS.md)
docs/**/*.md: Use the markdown files within thedocs/directory as a knowledge base and source of truth for project requirements, dependency choices, and architectural decisions.
When new decisions are made, requirements change, libraries are added/removed, or architectural patterns evolve, proactively update the relevant file(s) in thedocs/directory to reflect the latest state. Ensure the documentation remains accurate and current.
Files:
docs/architecture.md
**/*.md
📄 CodeRabbit Inference Engine (AGENTS.md)
**/*.md: Documentation must use en-GB-oxendict spelling and grammar. (EXCEPTION: the naming of the "LICENSE" file, which is to be left unchanged for community consistency.)
Validate Markdown files usingmake markdownlint.
Runmake fmtafter any documentation changes to format all Markdown files and fix table markup.
Validate Mermaid diagrams in Markdown files by runningmake nixie.
Markdown paragraphs and bullet points must be wrapped at 80 columns.
Code blocks must be wrapped at 120 columns.
Tables and headings must not be wrapped.
Use dashes (-) for list bullets.
Use GitHub-flavoured Markdown footnotes ([^1]) for references and footnotes.
Files:
docs/architecture.md
⚙️ CodeRabbit Configuration File
**/*.md: * Avoid 2nd person or 1st person pronouns ("I", "you", "we")
- Use en-GB-oxendict (-ize / -our) spelling and grammar
- Headings must not be wrapped.
- Documents must start with a level 1 heading
- Headings must correctly increase or decrease by no more than one level at a time
- Use GitHub-flavoured Markdown style for footnotes and endnotes.
- Numbered footnotes must be numbered by order of appearance in the document.
Files:
docs/architecture.md
**/*.rs
📄 CodeRabbit Inference Engine (AGENTS.md)
**/*.rs: Clippy warnings MUST be disallowed.
Fix any warnings emitted during tests in the code itself rather than silencing them.
Where a function is too long, extract meaningfully named helper functions adhering to separation of concerns and CQRS.
Where a function has too many parameters, group related parameters in meaningfully named structs.
Where a function is returning a large error consider usingArcto reduce the amount of data returned.
Every module must begin with a module level (//!) comment explaining the module's purpose and utility.
Document public APIs using Rustdoc comments (///) so documentation can be generated with cargo doc.
Prefer immutable data and avoid unnecessarymutbindings.
Handle errors with theResulttype instead of panicking where feasible.
Avoidunsafecode unless absolutely necessary and document any usage clearly.
Place function attributes after doc comments.
Do not usereturnin single-line functions.
Use predicate functions for conditional criteria with more than two branches.
Lints must not be silenced except as a last resort.
Lint rule suppressions must be tightly scoped and include a clear reason.
Preferexpectoverallow.
Prefer.expect()over.unwrap().
Useconcat!()to combine long string literals rather than escaping newlines with a backslash.
Prefer semantic error enums: Derivestd::error::Error(via thethiserrorcrate) for any condition the caller might inspect, retry, or map to an HTTP status.
Use an opaque error only at the app boundary: Useeyre::Reportfor human-readable logs; these should not be exposed in public APIs.
Never export the opaque type from a library: Convert to domain enums at API boundaries, and toeyreonly in the mainmain()entrypoint or top-level async task.
Files:
tests/footnotes.rssrc/footnotes.rs
⚙️ CodeRabbit Configuration File
**/*.rs: * Seek to keep the cyclomatic complexity of functions no more than 12.
Adhere to single responsibility and CQRS
Place function attributes after doc comments.
Do not use
returnin single-line functions.Move conditionals with >2 branches into a predicate function.
Avoid
unsafeunless absolutely necessary.Every module must begin with a
//!doc comment that explains the module's purpose and utility.Comments and docs must follow en-GB-oxendict (-ize / -our) spelling and grammar
Lints must not be silenced except as a last resort.
#[allow]is forbidden.- Only narrowly scoped
#[expect(lint, reason = "...")]is allowed.- No lint groups, no blanket or file-wide suppression.
- Include
FIXME:with link if a fix is expected.Use
rstestfixtures for shared setup and to avoid repetition between tests.Replace duplicated tests with
#[rstest(...)]parameterised cases.Prefer
mockallfor mocks/stubs.Prefer
.expect()over.unwrap()Ensure that any API or behavioural changes are reflected in the documentation in
docs/Ensure that any completed roadmap steps are recorded in the appropriate roadmap in
docs/Files must not exceed 400 lines in length
- Large modules must be decomposed
- Long match statements or dispatch tables should be decomposed by domain and collocated with targets
- Large blocks of inline data (e.g., test fixtures, constants or templates) must be moved to external files and inlined at compile-time or loaded at run-time.
Files:
tests/footnotes.rssrc/footnotes.rs
🔇 Additional comments (6)
src/footnotes.rs (1)
21-24: Accepting “.” or “:” in footnote definition lines looks good.The updated
FOOTNOTE_LINE_REcorrectly matches numbered definitions ending in a dot or a colon.tests/footnotes.rs (2)
87-100: Approve: Inline “number followed by colon” case is covered.The test asserts the intended transformation and matches the documented behaviour.
102-107: Approve: Footnote definition with colon is covered.The test verifies
FOOTNOTE_LINE_REand the block conversion path.docs/architecture.md (3)
99-105: Document colon-based references succinctly; this reads well.The section now clearly states “after punctuation or before a colon” and includes a minimal example.
113-115: Align examples with code: include colon in the “After” output.The examples correctly show “[^7]:” with the colon retained, consistent with the implementation.
Also applies to: 119-128
99-105: Avoid triple backticks inside Mermaid fencesPinpoint the offending label and rephrase to remove literal backticks:
• docs/architecture.md:55
Apply this diff:
- Streaming --> InCodeFence: Line is a fence delimiter ("```" or "~~~") + Streaming --> InCodeFence: Line is a fence delimiter ('backticks' or 'tildes')Likely an incorrect or invalid review comment.
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
This comment was marked as resolved.
This comment was marked as resolved.
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
Summary
7:references into[^7]:linksTesting
make fmtmake lintmake testmake markdownlintmake nixie(fails: RuntimeError: Error running command bun x --bun @mermaid-js/mermaid-cli mmdc -p /tmp/tmpw32pa7sq.json -i /tmp/tmp7i9oe1ec/architecture_1.mmd -o /tmp/tmp7i9oe1ec/architecture_1.svg for file 'docs/architecture.md' (diagram 1): error: too many arguments. Expected 0 arguments but got 1.)https://chatgpt.com/codex/tasks/task_e_68960ac13cc88322bb27b43391f38016
Summary by Sourcery
Add support for colon-separated footnote references and definitions in markdown processing, update related regex patterns, tests, and documentation.
New Features:
Enhancements:
Documentation:
Tests: