Anchor Syntax
en's anchor syntax can be very flexible, but some situations lead to ambiguity.
In short, following these two rules should keep you out of trouble:
- Avoid special characters in your node IDs: TOML allows you to use a wide range of characters in identifiers, but when writing your graph it's better keep your IDs simple
- When needed, use full three-pipe
|text|destination|syntax to make your anchors fully unambiguous
Punctuation in destinations
Consider this example:
|gem|PreciousStone |PreciousStone|,
Both point to the node with ID PreciousStone, as they indeed seem to. But if we didn't treat punctuation differently, we'd have:
|a|b |a|b
For this reason, some symbols are treated specially at the trailing boundary of anchors.
Punctuation won't be considered as a possible destination, so you can write the previous example and have it behave as expected.
This is one of the reasons special symbols in your node IDs can lead to trouble.
These are the punctuation symbols that are treated specially:
, . : ; ? ! ( ) ' " ` | _ *
Plural node anchors
Something similar applies to the lowercase letter s:
We found three |boat|s at the marina.
This conveniently lets you write plural words as anchors to their singular form without having to write:
We found three boats|boat at the marina.
Which is annoyting to write and also makes the text a lot noisier.
Unlike with punctuation, this doesn't mean you can't have a node with the ID s. You can, but you'll have to write your anchors to it always with a trailing pipe:
The |letter s|s| is important so we dedicated a whole page to it: |s|!
Spaced node anchors
Like punctuation, node IDs shouldn't have spaces. If you write a node anchor with spaces, it will be collapsed:
This |Node Anchor| will work as if it were |Node Anchor|NodeAnchor|.
As long as you don't have a page with the ID NodeanchoR and another with the ID NodeAnchor, this shouldn't be a problem.
Because node ID resolution redirects to a lowercase match as a fallback to an exact match, you can write:
The next |precious stone| was stolen in 1973.
And the visible text will be preserved as "precious stone" but be able to point to an ID such as PreciousStone.
URL detection
en must differentiate node anchors from outgoing URLs:
|sample|Example| |sample|https://example.com| |Example| |https://example.com|
It does this by looking at the destination and checking if it contains a :. That's one more reason to avoid this character in your node IDs.