slint/docs
2024-10-01 01:28:13 +02:00
..
_templates Add STM32 "SDKs" to the releaes artifacts table (#6176) 2024-09-17 08:54:10 +02:00
reference Docs: Show version warning banner 2024-10-01 01:28:13 +02:00
resources Revert release preparation 2024-09-23 15:36:16 +02:00
search Add sitemap and improve docsearch scraper 2024-10-01 00:14:13 +02:00
site Update from slint-ui/website 2024-07-03 10:05:16 +00:00
building.md Update MSRV to 1.77 2024-09-26 09:14:58 +02:00
development.md Document the preferred linear history approach a little (#4034) 2023-11-30 11:01:53 +01:00
install_qt.md reuse: remove glob for markdown files 2023-08-17 08:55:28 +02:00
README.md Add Typesense Search (#6314) 2024-09-27 20:18:41 +02:00
testing.md It seems that syntax_tests.rs was moved to ./internal/compiler/tests/ 2024-03-18 14:58:41 +01:00
torizon.md doc: add missing closing single quotes 2024-06-12 09:29:33 +02:00
triage.md Update triage.md 2024-09-10 11:09:46 +02:00
writing-style-guide.md Initial import of a basic style guide for docs, blog posts, and social media (#6389) 2024-09-30 18:02:24 +02:00

Tutorials

The source code for the Rust, C++, and Node.js versions of the Memory Game tutorial are located in the respect rust, cpp, and node sub-directories. They are built using mdbook.

Requirements

Building the tutorial requires mdbook, which you can install with cargo:

cargo install mdbook

Building

To build the tutorial, enter the rust, cpp, or node sub-directory and run:

mdbook build

The output will be in the book/html subdirectory. To check it out, open it in your web browser.

Code Samples

The code in the tutorial is available in separate steps in .rs, .cpp, and .js files.

The .rs files are mapped to different binaries, so you if you change into the rust/src sub-directory, then cargo run will present you with binaries for the different steps.

The .cpp files are built using cpp/src/CMakeLists.txt, which is included from the top-level CMakeLists.txt.

Building search database

We use Typesense for document search.

Infrastructure

  • Typesense Server: The Typesense Server will hold the search index.
  • Accessibility: The Typesense server must be accessible from the search bar in documentation site.
  • Docker: Docker is needed to run the Typesense Docsearch Scraper.
  • Typesense Docsearch Scraper: This tool will be used to index the documentation website.

Pre-requisites

pip3 install jq

Testing Locally

curl http://localhost:8108/health

Testing on Typesense Cloud

Creating search index

A helper script is located under search sub-folder that will (optionally) build the docs (currently only Slint docs), scrape the documents, and upload the search index to Typesense server.

The script accepts the following arguments

-a : API key to authenticate with Typesense Server (default: xyz)

-b : Build Slint docs (for testing locally set this flag ) (default: false)

-c : Location of config file (default: docs/search/scraper-config.json)

-d : Location of index.html of docs (default: target/slintdocs/html)

-i : Name of the search index (default: local)

-p : Port to access Typesense server (default: 8108)

-r : Remote Server when using Typesense Cloud

-u : URL on which the docs will be served (default: http://localhost:8000)

Example when running locally

docs/search/docsearch-scraper.sh -b

Example when running on Typesense Cloud, where $cluster_name is the name of the cluster on Typesense Cloud

docs/search/docsearch-scraper.sh -a API_KEY -b -r TYPESENSE_CLOUD_HOST_NAME

Testing search functionality

Run http server

python3 -m http.server -d target/slintdocs/html

Open browser (http://localhost:8000) and use the search bar to search for content