8000 Add search bar for documentation · Issue #3 · andy-hanson/crow · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Add search bar for documentation #3
Open
@andy-hanson

Description

@andy-hanson

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 over all-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 both script/lint.crow and the new code.
    • Omit common words like "the" from the search terms.
  • 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 script site-src/site.crow starts by running a crow 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0