Error if name contains $ #18

Closed
opened 2022-11-21 17:25:11 +01:00 by Saul-Mirone · 2 comments
Saul-Mirone commented 2022-11-21 17:25:11 +01:00 (Migrated from github.com)

If the name of variables and parameters contains $, an error will be thrown.

For example: $Slice.

If the name of variables and parameters contains `$`, an error will be thrown. For example: `$Slice`.
marijnh commented 2022-11-21 17:30:46 +01:00 (Migrated from github.com)

Are you sure? This is being used to build the prosemirror docs, which have a number of variables with $ in their name.

Are you sure? This is being used to build [the prosemirror docs](https://prosemirror.net/docs/ref/#state.Selection.$anchor), which have a number of variables with `$` in their name.
Saul-Mirone commented 2022-11-21 18:31:03 +01:00 (Migrated from github.com)

Yeah I'm sure about this. It only appears when I use top level API starts with $ in markdown template which means I need to declare the Item with @$Slice.

I think it's related to here:
https://github.com/marijnh/builddocs/blob/master/src/builddocs.js#L22

Seems the regex here only recoganize item names starts with \w, which means $ will out of this scope.
When I replace the \w with (\w|\$), seems everything works fine.

Yeah I'm sure about this. It only appears when I use top level API starts with `$` in markdown template which means I need to declare the Item with `@$Slice`. I think it's related to here: https://github.com/marijnh/builddocs/blob/master/src/builddocs.js#L22 Seems the regex here only recoganize item names starts with `\w`, which means `$` will out of this scope. When I replace the `\w` with `(\w|\$)`, seems everything works fine.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
marijn/builddocs#18
No description provided.