refactor: extract WikilinkProcessor from MarkdownPreprocessor

Extract comprehensive wikilink processing functionality into separate module:
- Move processWikilinks() method with complete implementation
- Extract sanitizeFilePath() as public method for reuse by embed processors
- Move sanitizeHeadingForLink() and resolveRelativePath() methods
- Remove duplicate WikilinkConfig interface
- Update all embed processors to use WikilinkProcessor.sanitizeFilePath()
- Add WikilinkProcessor configuration sync in updateConfig()
- Preserve all existing functionality and error handling

Reduces MarkdownPreprocessor from 895 to 816 lines (-79 lines).
WikilinkProcessor: 172 lines of focused wikilink processing logic.
Build passes successfully with no breaking changes.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Jarvis committed 2025-09-09 15:35:44 +02:00
1 parent 3843788351
commit 989d839de8
3 files changed
+226 -114

No files matched your search

+4 -4
View File
@@ -89,7 +89,7 @@ The main.ts file is the plugin entry point and most critical to get right.
**STOP** → Verify: `npm run build` passes
**STOP** → Test: Pandoc/Typst detection works
### Step 1.7: Update main.ts- DONE
### Step 1.7: Update main.ts - DONE
**Final size:** ~200 lines
**Keep:**
- Plugin class declaration
@@ -103,7 +103,7 @@ The main.ts file is the plugin entry point and most critical to get right.
## PHASE 2: Refactor MarkdownPreprocessor.ts - IN PROGRESS
### Step 2.1: Create FrontmatterProcessor.ts
### Step 2.1: Create FrontmatterProcessor.ts - DONE
**Location:** `src/converters/preprocessors/FrontmatterProcessor.ts` (~200 lines)
**Extract:**
- `processFrontmatter()` method
@@ -112,7 +112,7 @@ The main.ts file is the plugin entry point and most critical to get right.
**STOP** → Verify build → Test frontmatter parsing works
### Step 2.2: Create WikilinkProcessor.ts
### Step 2.2: Create WikilinkProcessor.ts - DONE
**Location:** `src/converters/preprocessors/WikilinkProcessor.ts` (~150 lines)
**Extract:**
- `parseWikilinks()` method
@@ -122,7 +122,7 @@ The main.ts file is the plugin entry point and most critical to get right.
**STOP** → Verify build → Test wikilink conversion works
### Step 2.3: Create EmbedProcessor.ts
### Step 2.3: Create EmbedProcessor.ts - IN PROGRESS
**Location:** `src/converters/preprocessors/EmbedProcessor.ts` (~250 lines)
**Extract:**
- `parseEmbeds()` method