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

Allow whitespace in Zettel ID #404

Merged
merged 9 commits into from
Sep 18, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
docs
  • Loading branch information
srid committed Sep 18, 2020
commit 0e100d000ce6248b866adb1366a59fd90be71fca
11 changes: 9 additions & 2 deletions guide/2011403.md
Original file line number Diff line number Diff line change
@@ -9,7 +9,14 @@ specify your own as well, as long as it contains only the following characters:
* hyphen (`-`)
* underscore (`_`)
* dot (`.`)
* whitespace

## Why prefer random IDs?
## When to use title IDs

Why does neuron use random alphameric IDs *by default*? Because then you are not forced to think of a suitable slug when writing a new note. A note's title may change in future, so could a slug. Generally, text editors make it easier to work with this, by automatically showing the title of the linked note next to the link (see [[4a6b25f1]]).
A title ID is one that uses arbitrary phrases (with whitespace characters). For example, in the link `[[Some note title]]` (see [[2011504]]), "Some note title" is the title ID, which is generated in the [[2011405]] as the HTML file named "Some_note_title.html".

Use title IDs when you want truly future-proof link IDs that work on any text editor. However, note that this comes at the cost that you are willing to rename them (manually or using a script) across your Zettelkasten if the title ID of any of your notes changes.

## When to prefer random IDs

The advantage to using random IDs (which neuron uses by default) is that you do not have to rename links across your Zettelkasten when changing the title IDs. This makes the links less future-proof, because you will want to use an editor (see [[4a6b25f1]]) that supports expanding them with the title from the note text.
4 changes: 2 additions & 2 deletions neuron/src/app/Neuron/CLI/Types.hs
Original file line number Diff line number Diff line change
@@ -144,10 +144,10 @@ commandParser defaultNotesDir now = do
idSchemeF <-
fmap
(const $ const $ Some IDSchemeHash)
(switch (long "id-hash" <> help "Use random hash ID (default)"))
(switch (long "--random-id" <> help "Generate a random ID (default)"))
<|> fmap
(const . Some . IDSchemeCustom)
(option str (long "id" <> help "Use a custom ID" <> metavar "IDNAME"))
(option str (long "id" <> help "Use an arbitrary title ID" <> metavar "IDNAME"))
pure $ New $ NewCommand title format dateParam (idSchemeF $ getDay dateParam) edit
openCommand = do
fmap Open $