Files
obsidian-typst-pdf-export/src/converters/preprocessors/MetadataExtractor.ts
T
Jarvis 09365e2d75 refactor: remove unused metadata extraction (tags/wordCount)
- Remove extractTags() and calculateWordCount() methods (dead code)
- Keep only extractTitle() method in MetadataExtractor
- Remove includeMetadata option and related infrastructure
- Update PreprocessingResult interfaces across all processors
- Remove wordCount from metadata schema
- Tags still populated from frontmatter (FrontmatterProcessor)
- Build verification passes without errors

Analysis showed these methods extracted data never consumed by Typst
templates or PDF generation pipeline.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-09 22:39:38 +02:00

25 lines
715 B
TypeScript

/**
* MetadataExtractor.ts
*
* Handles extraction of metadata from markdown content for PDF export.
* Currently focuses on title extraction from markdown headings.
*/
export class MetadataExtractor {
/**
* Extracts title from markdown content by looking for the first heading.
*
* @param content - The markdown content to extract title from
* @returns The title text if found, undefined otherwise
*/
public static extractTitle(content: string): string | undefined {
// Look for first heading
const headingMatch = content.match(/^#+\s+(.+)$/m);
if (headingMatch) {
return headingMatch[1].trim();
}
// Could be enhanced to use filename or frontmatter title
return undefined;
}
}