nvim-telekasten / telekasten.nvim

A Neovim (lua) plugin for working with a markdown zettelkasten / wiki and mixing it with a journal, based on telescope.nvim
MIT License
1.42k stars 91 forks source link

[BUG] The `{{title}}` keyword does not render in the note itself #203

Closed DennisTheMenace780 closed 1 year ago

DennisTheMenace780 commented 1 year ago

Please confirm

Describe the bug When creating a new note with a basic template the {{title}} keyword does not render when the note is created, despite being asked for a title on creation. In the code examples below, I have demonstrated what the resulting file would look like if I wanted to create a note with title: title-does-not-appear

Special Notes

To Reproduce Steps to reproduce the behavior:

  1. Start nvim
  2. Create a new template like so:
    ---
    title: {{title}}
    date: {{hdate}}
    ---
  3. run :Telekasten new_note
  4. When prompted for a title enter title-does-not-appear
  5. Observe that the note has been created and called title-does-not-appear.md, but {{title}} is not filled out although the file name is filled out.

Expected behavior Just like how {{hdate}} renders with the correct date, I expect that {{title}} ought to render with the correct title that I provide it.

Screenshots Screen Shot 2023-01-09 at 5 42 05 PM

Operating system (please complete the following information):

Additional context

nvim --version

NVIM v0.8.2
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by brew@HMBRW-A-001-M1-005.local

Plugin Configuration is below:

local status_ok, tel = pcall(require, "telekasten")
if not status_ok then
    return
end

local home = vim.fn.expand("~/zettelkasten")

tel.setup({
    home = home,

    -- if true, telekasten will be enabled when opening a note within the configured home
    take_over_my_home = true,

    -- auto-set telekasten filetype: if false, the telekasten filetype will not be used
    -- and thus the telekasten syntax will not be loaded either
    auto_set_filetype = false,
    -- dir names for special notes (absolute path or subdir name)
    dailies = home .. "/" .. "daily",
    weeklies = home .. "/" .. "weekly",
    templates = home .. "/" .. "templates",
    --
    -- image (sub)dir for pasting
    -- dir name (absolute path or subdir name)
    -- or nil if pasted images shouldn't go into a special subdir
    image_subdir = "img",

    -- markdown file extension
    extension = ".md",

    -- Generate note filenames. One of:
    -- "title" (default) - Use title if supplied, uuid otherwise
    -- "uuid" - Use uuid
    -- "uuid-title" - Prefix title by uuid
    -- "title-uuid" - Suffix title with uuid
    new_note_filename = "title",
    -- file uuid type ("rand" or input for os.date()")
    uuid_type = "%Y%m%d%H%M",
    -- UUID separator
    uuid_sep = "-",

    -- following a link to a non-existing note will create it
    follow_creates_nonexisting = true,
    dailies_create_nonexisting = true,
    weeklies_create_nonexisting = true,

    -- skip telescope prompt for goto_today and goto_thisweek
    journal_auto_open = false,

    -- template for new notes (new_note, follow_link)
    -- set to `nil` or do not specify if you do not want a template
    template_new_note = home .. "/" .. "templates/new_note.md",

    -- template for newly created daily notes (goto_today)
    -- set to `nil` or do not specify if you do not want a template
    template_new_daily = home .. "/" .. "templates/daily.md",

    -- template for newly created weekly notes (goto_thisweek)
    -- set to `nil` or do not specify if you do not want a template
    template_new_weekly = home .. "/" .. "templates/weekly.md",

    -- image link style
    -- wiki:     ![[image name]]
    -- markdown: ![](image_subdir/xxxxx.png)
    image_link_style = "markdown",

    -- default sort option: 'filename', 'modified'
    sort = "filename",

    -- integrate with calendar-vim
    plug_into_calendar = true,
    calendar_opts = {
        -- calendar week display mode: 1 .. 'WK01', 2 .. 'WK 1', 3 .. 'KW01', 4 .. 'KW 1', 5 .. '1'
        weeknm = 4,
        -- use monday as first day of week: 1 .. true, 0 .. false
        calendar_monday = 1,
        -- calendar mark: where to put mark for marked days: 'left', 'right', 'left-fit'
        calendar_mark = "left-fit",
    },
    -- telescope actions behavior
    close_after_yanking = false,
    insert_after_inserting = true,

    -- tag notation: '#tag', ':tag:', 'yaml-bare'
    tag_notation = "#tag",

    -- command palette theme: dropdown (window) or ivy (bottom panel)
    command_palette_theme = "dropdown",

    -- tag list theme:
    -- get_cursor: small tag list at cursor; ivy and dropdown like above
    show_tags_theme = "dropdown",

    -- when linking to a note in subdir/, create a [[subdir/title]] link
    -- instead of a [[title only]] link
    subdirs_in_links = true,

    -- template_handling
    -- What to do when creating a new note via `new_note()` or `follow_link()`
    -- to a non-existing note
    -- - prefer_new_note: use `new_note` template
    -- - smart: if day or week is detected in title, use daily / weekly templates (default)
    -- - always_ask: always ask before creating a note
    template_handling = "smart",

    -- path handling:
    --   this applies to:
    --     - new_note()
    --     - new_templated_note()
    --     - follow_link() to non-existing note
    --
    --   it does NOT apply to:
    --     - goto_today()
    --     - goto_thisweek()
    --
    --   Valid options:
    --     - smart: put daily-looking notes in daily, weekly-looking ones in weekly,
    --              all other ones in home, except for notes/with/subdirs/in/title.
    --              (default)
    --
    --     - prefer_home: put all notes in home except for goto_today(), goto_thisweek()
    --                    except for notes with subdirs/in/title.
    --
    --     - same_as_current: put all new notes in the dir of the current note if
    --                        present or else in home
    --                        except for notes/with/subdirs/in/title.
    new_note_location = "smart",

    -- should all links be updated when a file is renamed
    rename_update_links = true,

    vaults = {
        work = {
            -- alternate configuration for vault2 here. Missing values are defaulted to
            -- default values from telekasten.
            -- e.g.
            -- home = "/home/user/vaults/personal",
            -- markdown file extension
            extension = ".md",
            template_handling = "smart",
            home = home .. "/" .. "work",
            dailies = home .. "/" .. "work/daily",
            weeklies = home .. "/" .. "work/weekly",
            templates = home .. "/" .. "work/templates",
        },
    },

    -- how to preview media files
    -- "telescope-media-files" if you have telescope-media-files.nvim installed
    -- "catimg-previewer" if you have catimg installed
    media_previewer = "telescope-media-files",

    -- A customizable fallback handler for urls.
    follow_url_fallback = nil,
})
DennisTheMenace780 commented 1 year ago

I don't really understand what happened or what I ended up doing here, but now it's no longer an issue and everything works as expected. Going to leave this open though for a little while just incase someone feels like exploring this for the benefit of others.

lambtho12 commented 1 year ago

This was fixed in #198 two days ago. I guess you were not completely up-to-date.

I will close to keep things somewhat tidy, but do not hesitate to re-open if it reappears.