[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/denote 2efd133a29 2/3: Define WORK-IN-PROGRESS file typ
From: |
ELPA Syncer |
Subject: |
[elpa] externals/denote 2efd133a29 2/3: Define WORK-IN-PROGRESS file type with Obsidian-style front matter |
Date: |
Wed, 20 Nov 2024 06:57:54 -0500 (EST) |
branch: externals/denote
commit 2efd133a295f316a155c65c16643cd3612b1f73a
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>
Define WORK-IN-PROGRESS file type with Obsidian-style front matter
This does not work yet for common actions like renaming the file based
on its front matter. I will continue testing how viable this is and if
it is worth pursuing. I do not want to make the code more complex to
accommodate this use-case, so let's see how it goes.
---
denote-md-extras.el | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/denote-md-extras.el b/denote-md-extras.el
index c1e572537b..f522515ae9 100644
--- a/denote-md-extras.el
+++ b/denote-md-extras.el
@@ -29,6 +29,38 @@
(require 'denote)
+;;;; Register a new file type
+
+(defvar denote-md-extras-obsidian-format "# %s\n\n"
+ "Format of Obsidian-style Markdown front matter.")
+
+;; FIXME 2024-11-20: This works for file creation but is broken for
+;; other common operations.
+(add-to-list
+ 'denote-file-types
+ '(markdown-obsidian
+ :extension ".md"
+ :front-matter denote-md-extras-obsidian-format
+ :title-key-regexp "^# "
+ :title-value-function identity
+ :title-value-reverse-function identity
+ :keywords-key-regexp ""
+ :keywords-value-function identity
+ :keywords-value-reverse-function identity
+ :signature-key-regexp ""
+ :signature-value-function identity
+ :signature-value-reverse-function identity
+ :identifier-key-regexp ""
+ :identifier-value-function identity
+ :identifier-value-reverse-function identity
+ :date-key-regexp ""
+ :date-value-function identity
+ :date-value-reverse-function identity
+ :link denote-md-link-format
+ :link-in-context-regexp denote-md-link-in-context-regexp))
+
+;;;; Convert links
+
(defun denote-md-extras--get-regexp (type)
"Return regular expression to match link TYPE.
TYPE is a symbol among `denote', `file', `obsidian', and `reverse-obsidian'."