Skip to content

how do i change the naming scheme when creating a new file. #295

Answered by epwalsh
shawaman asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @shawaman, in your configuration you can specify a note_id_func. This is just a Lua function that's responsible for determining the ID/filename of new notes based on the title. The function I use personally looks like this:

  note_id_func = function(title)
    -- Create note IDs in a Zettelkasten format with a timestamp and a suffix.
    -- In this case a note with the title 'My new note' will be given an ID that looks
    -- like '1657296016-my-new-note', and therefore the file name '1657296016-my-new-note.md'
    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(…

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
4 replies
@shawaman
Comment options

@shawaman
Comment options

@epwalsh
Comment options

@rodhash
Comment options

Answer selected by shawaman
Comment options

You must be logged in to vote
1 reply
@rodhash
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants