Description
Here's how I think this could be implemented:
-
Modify
site-src/document-content.crow
to provide an ID for each function/type/spec, so that a link can refer to the particular function. E.g.:/doc/crow/compare.html#equal
.- It's not important to distinguish overloads (or a type and function having the same name) since they should be close together anyway
-
Modify
site-src/document.crow
walk overall-modules
and collect search terms.- See
module.crow
for the type definition of a module. Just walk over the tree that represents a module and collect search terms. - Split doc comments into words to get search terms.
script/lint.crow
already has a function for parsing words, so that could go in a module shared by bothscript/lint.crow
and the new code. - Omit common words like "the" from the search terms.
- See
-
Store the search terms in a file
doc/search.json
(exact format can be whatever). Load that in the browser and use that to implement a search box.- Put this at the top of the navigation pane on the left.
- Based on a brief search fuse.js seems to implement this kind of functionality. Other libraries could be used.
-
An alternative would be to use the results of
crow doc
directly. The scriptsite-src/site.crow
starts by running acrow doc
command. This generates 539KB of data though; it includes things like parameter information that isn't relevant for search. I think if we parse out the search terms ahead of time we can get a smaller format.