Skip to content

Latest commit

 

History

History
78 lines (53 loc) · 2 KB

CONTRIBUTING.md

File metadata and controls

78 lines (53 loc) · 2 KB

Contribute to typesense-minibar

How it works

  • Cut the mustard using type="module".

Internal API

tsminibar(document.querySelector('#myform'))`

Function parameters:

  • {HTMLElement} form: The element must have data-origin, data-collection, and data-key, attributes; and contain a descendent of <input type="search">.

Typesense API

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.

Development

Start local server for the demo:

python3 -m http.server 4100

Open http://localhost:4100/demo/

Release process

  1. 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
  1. Stage commit and push for review.
git add -p && \
git commit -m "Release $MINIBAR_VERSION" && \
git push origin HEAD:release
  1. 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
  1. Push signed tag to Git and publish to npm.
git tag -s $MINIBAR_VERSION -m "Release $MINIBAR_VERSION" && git push --tags
npm publish