Function: org-roam-node-slugify
org-roam-node-slugify is a byte-compiled function defined in
org-roam-node.el.
Signature
(org-roam-node-slugify TITLE)
Documentation
Slugify TITLE.
Source Code
;; Defined in ~/.emacs.d/elpa/org-roam-20260224.1637/org-roam-node.el
(defun org-roam-node-slugify (title)
"Slugify TITLE."
(require 'ucs-normalize)
(let ((slug-trim-chars
;; Combining Diacritical Marks https://www.unicode.org/charts/PDF/U0300.pdf
;; For why these specific glyphs: https://github.com/org-roam/org-roam/pull/1460
'( #x300 #x301 #x302 #x303 #x304 #x306 #x307
#x308 #x309 #x30A #x30B #x30C #x31B #x323
#x324 #x325 #x327 #x32D #x32E #x330 #x331)))
(thread-last title
(ucs-normalize-NFD-string) ;; aka. `string-glyph-decompose' from Emacs 29
(seq-remove (lambda (char) (memq char slug-trim-chars)))
(apply #'string)
(ucs-normalize-NFC-string) ;; aka. `string-glyph-compose' from Emacs 29
(replace-regexp-in-string "[^[:alnum:]]" "_") ;; convert anything not alphanumeric
(replace-regexp-in-string "__*" "_") ;; remove sequential underscores
(replace-regexp-in-string "^_" "") ;; remove starting underscore
(replace-regexp-in-string "_$" "") ;; remove ending underscore
(downcase))))