-
Notifications
You must be signed in to change notification settings - Fork 2
Description
A variable with a name like this [ref-01] contains a math symbol (-) and so is actually treated as two variable names ref and 01.
However, math is only checked during variable expression when a $ prefix is attached. This can lead to weird shenanigans:
$[label-with+math]: url // Assign variable
[label-with+math] // Output as link
$[label-with+math] // Fails because math is attempted
This will assign url to label-with+math and even express it as a link. However $[label-with+math] will not be able to access that variable because math is attempted first. For consistency, checking for math should be done in the variable assignment step as well.
Consideration
One thing to consider, is if we want to allow hyphenated var names, which has already come up naturally a few times. We could potentially restrict math to require spaces between operators which may be less confusing to users:
$[hyphenated-name] vs $[math - expression]
Test Cases
@ericscheid tested a range of other edge cases, some of which show related symptoms:
