Skip to content

Instantly share code, notes, and snippets.

@obuchtala
Last active November 30, 2017 23:51
Show Gist options
  • Select an option

  • Save obuchtala/9ec253b95f26c88b3cc98417c3bfed1b to your computer and use it in GitHub Desktop.

Select an option

Save obuchtala/9ec253b95f26c88b3cc98417c3bfed1b to your computer and use it in GitHub Desktop.
How the search field of typedoc generated documentation works
<html>
<head>
<style type="text/css">
#tsd-search > ul > .current {
background: red;
}
</style>
</head>
<body>
<div id="tsd-search">
<div class="field">
<input id="tsd-search-field" type="text" />
</div>
<ul class="results"></ul>
</div>
<script type="text/javascript" src="./build/api/assets/js/main.js"></script>
<script type="text/javascript" src="./build/api/assets/js/search.js"></script>
</body>
</html>
@obuchtala
Copy link
Author

obuchtala commented Nov 30, 2017

  • use typedoc to generate api docs into 'build/api'
  • it is important to load the two scripts after having the search field in the DOM
  • lunr data is coming from search.js
  • the search field interactions are provided by main.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment