branch: externals/denote
commit 2bc5df6011b345cbe2e6c1024cc5ca5b0feca36a
Author: Protesilaos Stavrou <[email protected]>
Commit: Protesilaos Stavrou <[email protected]>
denote-file-type: 'markdown-yaml', not 'markdown'
This makes it specific that the front matter is YAML-compliant. It also
gives us the option to support TOML.
Thanks to Kaushal Modi for the feedback in issue 4 over at the GitHub
mirror: <https://github.com/protesilaos/denote/issues/4>.
---
README.org | 6 +++---
denote.el | 23 ++++++++++++-----------
2 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/README.org b/README.org
index d89c6af2a3..e895d863e8 100644
--- a/README.org
+++ b/README.org
@@ -252,8 +252,8 @@ This is how it looks for Org mode (~denote-file-type~ is
nil):
#+identifier: 20220610T134640
#+end_example
-For Markdown, it looks like this (~denote-file-type~ has the =markdown=
-value):
+For Markdown, it looks like this (~denote-file-type~ has the
+=markdown-yaml= value):
#+begin_src emacs-lisp
---
@@ -511,7 +511,7 @@ Everything is in place to set up the package.
'("emacs" "philosophy" "politics" "economics"))
(setq denote-infer-keywords t)
(setq denote-sort-keywords t)
-(setq denote-file-type nil) ; default is Org mode, else set `markdown' or
`text'
+(setq denote-file-type nil) ; default is Org mode, else set `markdown-yaml' or
`text'
(setq denote-front-matter-date-format 'org-timestamp)
diff --git a/denote.el b/denote.el
index bdb23d64a2..f6ab12da7a 100644
--- a/denote.el
+++ b/denote.el
@@ -117,15 +117,16 @@ If nil, show the keywords in their given order."
By default (a nil value), the file type is that of Org mode.
-When the value is the symbol `markdown', the file type is that of
-Markdown mode.
+When the value is the symbol `markdown-yaml', the file type is
+that of Markdown mode and the front matter uses a YAML-compliant
+way to represent tags.
When the value is `text', the file type is that of Text mode.
Any other non-nil value is the same as the default."
:type '(choice
(const :tag "Org mode (default)" nil)
- (const :tag "Markdown" markdown)
+ (const :tag "Markdown" markdown-yml)
(const :tag "Plain text" text))
:group 'denote)
@@ -315,7 +316,7 @@ output is sorted with `string-lessp'."
(defun denote--file-extension ()
"Return file type extension based on `denote-file-type'."
(pcase denote-file-type
- ('markdown ".md")
+ ('markdown-yaml ".md")
('text ".txt")
(_ ".org")))
@@ -349,13 +350,13 @@ TITLE, DATE, KEYWORDS, FILENAME, ID are all strings which
are
provided by `denote-new-note'."
(let ((kw (denote--file-meta-keywords keywords)))
(pcase denote-file-type
- ('markdown (concat "---" "\n"
- "title: " title "\n"
- "date: " date "\n"
- "tags: " kw "\n"
- "identifier: " id "\n"
- "---" "\n"
- "\n"))
+ ('markdown-yaml (concat "---" "\n"
+ "title: " title "\n"
+ "date: " date "\n"
+ "tags: " kw "\n"
+ "identifier: " id "\n"
+ "---" "\n"
+ "\n"))
('text (concat "title: " title "\n"
"date: " date "\n"