Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a note without id or - #754

Open
barcell1 opened this issue Oct 18, 2024 · 2 comments
Open

Create a note without id or - #754

barcell1 opened this issue Oct 18, 2024 · 2 comments

Comments

@barcell1
Copy link

🚀 The feature, motivation and pitch

i like to create a note and obsidian didnt transform the title. Like [[my new note]] will become "my new note.md"
I tried to tweak the functions in config but dont have the intelligence to make work without errors

Alternatives

No response

Additional context

No response

@rofe33
Copy link

rofe33 commented Oct 21, 2024

You can customize the created note path in:

  -- Optional, customize how note file names are generated given the ID, target directory, and title.
  ---@param spec { id: string, dir: obsidian.Path, title: string|? }
  ---@return string|obsidian.Path The full path to the new note.
  note_path_func = function(spec)
    -- This is equivalent to the default behavior.
    local path = spec.dir / tostring(spec.id)
    return path:with_suffix(".md")
  end,

To achieve what you want, add this in the configs:

  -- Optional, customize how note file names are generated given the ID, target directory, and title.
  ---@param spec { id: string, dir: obsidian.Path, title: string|? }
  ---@return string|obsidian.Path The full path to the new note.
  note_path_func = function(spec)
    local path = spec.dir / tostring(spec.title)
    return path:with_suffix(".md")
  end,

Note: This will changes just the filename not the id, the id by default will be timestamp-####, to change it check: Random ID as note name instead of the actual note name · Issue #756 · epwalsh/obsidian.nvim · GitHub.

@barcell1
Copy link
Author

barcell1 commented Nov 2, 2024

thanks, it did work. But now how do i prevent to it not create a alias with the same name of my title ?

since my file name already have the name that i want, dont need to the alias have the same name

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants