Problem
Link and anchor extraction uses hardcoded regex patterns scattered throughout extractLinks() and extractAnchors() methods.
Patterns Currently Hardcoded
| Type |
Pattern |
Code Location |
| Link |
[text](file.md#anchor) |
extractLinks:118 |
| Link |
[cite: path] |
extractLinks:165 |
| Link |
[[file#anchor|text]] |
extractLinks:266 |
| Link |
[[#anchor|text]] |
extractLinks:313 |
| Link |
[text](#anchor) |
extractLinks:354 |
| Link |
^anchor-id reference |
extractLinks:395 |
| Anchor |
## Header Text |
extractAnchors:600 |
| Anchor |
^block-id |
extractAnchors:551 |
Proposed Solution
Refactor to Strategy Pattern (like ExtractionStrategy in ContentExtractor) for:
- Pluggable pattern registration
- Easier testing of individual patterns
- Support for custom/user-defined patterns
Priority
Low - current implementation works; refactor when adding new patterns.
Acceptance Criteria
Definition of Done
Problem
Link and anchor extraction uses hardcoded regex patterns scattered throughout
extractLinks()andextractAnchors()methods.Patterns Currently Hardcoded
[text](file.md#anchor)[cite: path][[file#anchor|text]][[#anchor|text]][text](#anchor)^anchor-idreference## Header Text^block-idProposed Solution
Refactor to Strategy Pattern (like
ExtractionStrategyin ContentExtractor) for:Priority
Low - current implementation works; refactor when adding new patterns.
Acceptance Criteria
Definition of Done
npm run build -w tools/citation-manager && npm link -w tools/citation-manager