Set up normal obsidian naming conventions
This commit is contained in:
parent
6be120ede6
commit
d7c432167f
1 changed files with 14 additions and 0 deletions
|
|
@ -20,4 +20,18 @@ require("obsidian").setup({
|
||||||
-- A map for custom variables, the key should be the variable and the value a function
|
-- A map for custom variables, the key should be the variable and the value a function
|
||||||
substitutions = {},
|
substitutions = {},
|
||||||
},
|
},
|
||||||
|
note_id_func = function(title)
|
||||||
|
local suffix = ""
|
||||||
|
if title ~= nil then
|
||||||
|
-- If title is given, transform it into valid file name.
|
||||||
|
suffix = title:gsub(" ", "-"):gsub("[^A-Za-z0-9-]", ""):lower()
|
||||||
|
else
|
||||||
|
-- If title is nil, just add 4 random uppercase letters to the suffix.
|
||||||
|
for _ = 1, 4 do
|
||||||
|
suffix = suffix .. string.char(math.random(65, 90))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return suffix
|
||||||
|
end,
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue