MCPcopy
hub / github.com/callumalpass/tasknotes / extractCleanTitle

Method extractCleanTitle

src/utils/TasksPluginParser.ts:703–724  ·  view source on GitHub ↗
(content: string)

Source from the content-addressed store, hash-verified

701 }
702
703 private static extractCleanTitle(content: string): string {
704 if (typeof content !== "string") {
705 return "";
706 }
707
708 try {
709 let cleanContent = content;
710 cleanContent = cleanContent.replace(this.TAG_PATTERN, "");
711 cleanContent = cleanContent.replace(this.CONTEXT_PATTERN, "");
712 cleanContent = cleanContent.replace(this.DATAVIEW_FIELD_ANY_PATTERN, "");
713
714 const cleaned = cleanContent.replace(/\s+/g, " ").trim();
715 return cleaned.length === 0 ? "Untitled Task" : cleaned;
716 } catch (error) {
717 tasknotesLogger.debug("Error extracting clean title:", {
718 category: "validation",
719 operation: "extracting-clean-title",
720 error: error,
721 });
722 return "Untitled Task";
723 }
724 }
725
726 /**
727 * Validate if a line contains Tasks plugin metadata.

Callers 1

parseTaskContentMethod · 0.95

Calls 1

debugMethod · 0.80

Tested by

no test coverage detected