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

[Suggestion]: Generalize Scoping Modifier #36

Open
vhyrro opened this issue Jul 21, 2024 · 0 comments
Open

[Suggestion]: Generalize Scoping Modifier #36

vhyrro opened this issue Jul 21, 2024 · 0 comments

Comments

@vhyrro
Copy link
Member

vhyrro commented Jul 21, 2024

This suggestion stems from @boltlessengineer's idea on discord. The goal of this suggestion is to generalize the : syntax to make more sense in the context of the Norg specification.

With these new changes, the old scoping modifier (:) is substituted just for : (no surrounding spaces).
When a link starts with :, this starts a scope at the path to the current file. Therefore, {:myfile} is a link to myfile.norg in the current directory. Of course, {:myfile:} is still permitted, it's just that the second scoping modifier does nothing.

This makes the entire syntax much more intuitive. For instance, {:myfile:* Heading} now makes logical sense: first, we enter the scope of the current dir, then myfile.norg, then we limit the scope to just * Heading.

The reason the old syntax required surrounding whitespace is to prevent situations like this:

* My Life: The Truth

This is a link to {* My Life: The Truth}.

With this new syntax proposal the : has a higher precedence within a link, therefore to link to such a heading one would need to escape the colon using \:. This is a fair compromise (there is no better alternative without massively altering syntax).

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

No branches or pull requests

1 participant