stdlib-js / www

Website for stdlib, a standard library for JavaScript and Node.js.
https://stdlib.io
Apache License 2.0
7 stars 8 forks source link

[RFC]: add support for filtering the side menu by REPL alias #17

Open kgryte opened 2 years ago

kgryte commented 2 years ago

Description

This RFC proposes adding support for filtering the side menu according to a package's REPL alias.

Currently, a user can filter according to the nested package tree in the main project. However, it would be nice if a user could also filter according to REPL alias.

For example, the query

base.sin

would resolve the package

@stdlib/math/base/special/sin

in the side menu.

Similarly, the query

base.(sin|cos)

would resolve the packages

@stdlib/math/base/special/cos
@stdlib/math/base/special/sin

in the side menu.

Related Issues

No.

Questions

No.

Other

No.

Checklist

kgryte commented 2 years ago

This is a little tricky to do because the side menu filter currently supports regular expression filters which may include the use of a . to indicate any character, not a literal period.

Hence, could be hard to disambiguate whether a user wants to search based on a REPL alias or a regular expression using the special . character.

kgryte commented 2 years ago

Limiting filtering by REPL alias to only when the REPL API docs mode is active does not fully address the ambiguity. While it would provide a strong indication that a user wants to filter by alias, we would not be able to readily distinguish between

base.si

and

base..in

where, in the former, we want to use the . as a delimiter and, in the latter, to represent any character.