Skip to content

uhop/wiki-search

Repository files navigation

wiki-search NPM version

GitHub wikis are great for docs but have no real search. wiki-search adds it: a bookmarklet (plus a hosted search page) that searches a wiki and takes you straight to the matching section — without moving your docs off the wiki.

Try the live demo & install the bookmarklet

Use it

  • Search a wiki. Drag the bookmarklet to your bookmarks bar, then open any GitHub wiki that has a wiki-search index and search — each result jumps you to the exact section. (Try it now on this project's own wiki — no install needed.)

  • Add search to your own wiki. Build an index from your Markdown — needs Node, nothing to install:

    npx wiki-search-index --wiki ./your-wiki   # → your-wiki/search-index.json

    Commit that search-index.json into your wiki, then add a one-line Search section. Full guide — including keeping the index fresh — Add search to your wiki.

How it works

The bookmarklet opens the search page on its own GitHub Pages origin, so the wiki page's security policy can't block it. There it loads a small JSON index built from the wiki's Markdown and links each result with a text fragment, so your browser scrolls to — and, where supported, highlights — the matched phrase. By default a result re-uses your current tab; Back returns you. The index carries its own URL template, so the same app works for any site with no hardcoded host.

Repo layout & local run
Path What
index.html Landing + bookmarklet-install page (the Pages root).
app/ The search page (loads + validates an index, searches, links out).
builder/ wiki-index CLI: Markdown → the JSON index.
engine/ Search core: MiniSearch (vendored), with a zero-dep fallback.
bookmarklet/ The bookmarklet — one constant, imported by the app + install page.

Run locally: python3 -m http.server from the repo root, then open http://localhost:8000/app/?wiki=uhop/wiki-search.

Release notes

  • 0.1.0 Initial release of the wiki-search-index builder.

License

BSD-3-Clause

About

Add real search to any GitHub wiki — a bookmarklet + hosted page that jump you to the matching section

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors