Requirements and features for the Cool-Digest Script implemented in Templater scripting language for Obsidian (not JS)
-
Content Blocks Processing:
- Retrieve the current file in Obsidian
- The boundaries of a content block are defined by H1-H3 headers or beginning or end of file
- Process each content block
- Handle empty content blocks with appropriate error messages
- Deformat the content block before digesting (remove markdown formatting)
- Track and report on removed formatting elements
-
Hash Generation:
- Generate a 12-character SHA-256 hash of the deformatted content
- Ensure consistent hash generation for identical content
-
Digest & Seal Marks:
- Digest Mark in the format:
[✉️](https://WikiWe.org/Notes/ds/block/{digest-hash}?ts={date}&authors={authors}&cc={character-count}&wc={word-count}&lc={line-count}) - Seal Mark in the format:
[🔒](https://WikiWe.org/Notes/ds/seal/{seal-hash}?ts={date}&authors={authors}&cc={character-count}&wc={word-count}&lc={line-count}) - Use the current date (YYYY-MM-DD format)
- Digest Mark in the format:
-
Content Modification:
- Append the Digest Mark to the end of each content block
- Preserve any existing Seal Mark when modifying content
-
Multiple Mark Handling:
- Detect and handle multiple existing Digest Marks
- Detect and handle multiple existing Seal Marks
- Use the last Digest Mark if multiple are found (with warning)
- Preserve the last Seal Mark if multiple are found (with warning)
-
Verification of Existing Digests:
- Check for existing Digest Marks in each content block before processing
- Verify if the content matches an existing digest
- Allow re-digesting if the content has changed
- Skip re-digesting if the content is unchanged (idempotency)
-
Deformatting removes
-
User Feedback and Logging:
- Provide clear, detailed notices to the user about the digest process
- Uses Notice() and console.log()
- Log detailed information about each step of the process
- Include version number v1.6 in notices and logs
- Log the deformatted content for debugging purposes
-
Error Handling:
- Handle and report errors for invalid content blocks
- Handle and report errors for file system operations
- Provide clear error messages for verification failures
-
Performance and Optimization:
- Ensure efficient processing of large content blocks
- Optimize file I/O operations
-
Content Statistics:
- Calculate and report word count
- Calculate and report character count
- Calculate and report line count
-
Idempotency:
- Ensure running the script multiple times on unchanged content produces the same result
-
Frontmatter Handling:
- Extract authors information from frontmatter
authorsif available
- Extract authors information from frontmatter
-
Preservation of Original Formatting:
- Ensure the original formatting of the content is preserved in the document