- Cut the mustard using
type="module"
.
tsminibar(document.querySelector('#myform'))`
Function parameters:
{HTMLElement} form
: The element must havedata-origin
,data-collection
, anddata-key
, attributes; and contain a descendent of<input type="search">
.
The highlight_full_fields
and include_fields
query is compatible with the query in typesense-docsearch.js:/DocSearchModal.tsx.
The backend response is documented at https://typesense.org/docs/0.24.1/api/search.html. In particular, we assume the following:
hit.document.hierarchy.*
: This is already HTML-escaped. HTML tags are stripped from the original content, and special characters are escaped with HTML entities.hit.highlights[0].snippet
: This is also trusted HTML. Some words may be wrapped in a<mark>
element, to highlight matching words.
Start local server for the demo:
python3 -m http.server 4100
Open http://localhost:4100/demo/
- Bump version numbers
export MINIBAR_VERSION=x.y.z
sed -i'.bak' "s/typesense-minibar [0-9\.]*/typesense-minibar $MINIBAR_VERSION/" typesense-minibar* && \
sed -i'.bak' "s/minibar@[^/]*/minibar@$MINIBAR_VERSION/g" README.md && \
sed -i'.bak' 's/"version": "[^"]*"/"version": "'$MINIBAR_VERSION'"/' package.json && \
rm *.bak
- Stage commit and push for review.
git add -p && \
git commit -m "Release $MINIBAR_VERSION" && \
git push origin HEAD:release
- Merge once CI has passed, or test locally in a secure environment using
npm install-test
.
git push origin HEAD:main
Clean up old branch:
git push origin :release
git remote prune origin
- Push signed tag to Git and publish to npm.
git tag -s $MINIBAR_VERSION -m "Release $MINIBAR_VERSION" && git push --tags
npm publish