Compare commits

...

8 commits

Author SHA1 Message Date
Johannes Marbach 0c2e66280c
Merge e679a00720 into 22f3cc009b 2026-03-17 13:16:31 +00:00
Johannes Marbach e679a00720 Override search-input template
Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>
2026-03-17 14:16:24 +01:00
Johannes Marbach 7dfd746e06 Remove leftovers
Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>
2026-03-17 13:21:42 +01:00
Johannes Marbach 77f7e8104a Merge branch 'main' into johannes/page-search 2026-03-17 13:09:06 +01:00
Johannes Marbach b3d4f9a96e Change to using Pagefind via the built-in Docsy search UI
Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>
2026-03-17 13:04:43 +01:00
No. 22f3cc009b
Fix typo for origin_server_ts field for in-room verification events (#2337)
Some checks are pending
Spec / 🔎 Validate OpenAPI specifications (push) Waiting to run
Spec / 🔎 Check Event schema examples (push) Waiting to run
Spec / 🔎 Check OpenAPI definitions examples (push) Waiting to run
Spec / 🔎 Check JSON Schemas inline examples (push) Waiting to run
Spec / ⚙️ Calculate baseURL for later jobs (push) Waiting to run
Spec / 🐍 Build OpenAPI definitions (push) Blocked by required conditions
Spec / 📢 Run towncrier for changelog (push) Waiting to run
Spec / 📖 Build the spec (push) Blocked by required conditions
Spec / 🔎 Validate generated HTML (push) Blocked by required conditions
Spec / 📖 Build the historical backup spec (push) Blocked by required conditions
Spec / Create release (push) Blocked by required conditions
Spell Check / Spell Check with Typos (push) Waiting to run
* Fix typo for origin_server_ts field for in-room verification events

Signed-off-by: tusooa <tusooa@kazv.moe>

* Update changelogs/client_server/newsfragments/2337.clarification

---------

Signed-off-by: tusooa <tusooa@kazv.moe>
Co-authored-by: Travis Ralston <travpc@gmail.com>
2026-03-17 01:20:11 +00:00
Kévin Commaille ce3aecab38
Fix newsfragments (#2338)
* Fix typo in newsfragment

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>

* Fix location of newsfragment

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>

* Add changelogs

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>

* Update changelogs/server_server/newsfragments/2338.clarification

---------

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
Co-authored-by: Travis Ralston <travpc@gmail.com>
2026-03-17 01:18:37 +00:00
Johannes Marbach fdd2a9abe8 Add page search widget
Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>
2026-03-06 15:25:50 +01:00
12 changed files with 192 additions and 3 deletions

View file

@ -236,6 +236,10 @@ jobs:
run: |
tar -C "spec${baseURL}" --strip-components=1 -xzf openapi.tar.gz
- name: "🔍 pagefind indexing"
run: |
npx -y pagefind --site "spec${baseURL}"
- name: "📦 Tarball creation"
run: |
cd spec

164
assets/js/offline-search.js Normal file
View file

@ -0,0 +1,164 @@
/*
Copyright 2026 The Matrix.org Foundation C.I.C.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Adapted from [1] to combine Docsy's built-in search UI with the Pagefind
search backend.
[1]: https://github.com/matrix-org/docsy/blob/71d103ebb20ace3d528178c4b6d92b6cc4f7fd53/assets/js/offline-search.js
*/
(function ($) {
'use strict';
$(document).ready(async function () {
const pagefind = await import("/pagefind/pagefind.js");
const $searchInput = $('.td-search input');
//
// Lazily initialise Pagefind only when the user is about to start a search.
//
$searchInput.focus(() => {
pagefind.init();
});
//
// Register handler
//
$searchInput.on('change', (event) => {
render($(event.target));
// Hide keyboard on mobile browser
$searchInput.blur();
});
// Prevent reloading page by enter key on sidebar search.
$searchInput.closest('form').on('submit', () => {
return false;
});
//
// Pagefind
//
const render = async ($targetSearchInput) => {
//
// Dispose existing popover
//
{
let popover = bootstrap.Popover.getInstance($targetSearchInput[0]);
if (popover !== null) {
popover.dispose();
}
}
//
// Search
//
const searchQuery = $targetSearchInput.val();
if (searchQuery === '') {
return;
}
const search = await pagefind.debouncedSearch(searchQuery);
if (search === null) {
// A more recent search call has been made, nothing to do.
return;
}
const results = await Promise.all(search.results.slice(0, 20).map(r => r.data()));
//
// Make result html
//
const $html = $('<div>');
$html.append(
$('<div>')
.css({
display: 'flex',
justifyContent: 'space-between',
marginBottom: '1em',
})
.append(
$('<span>').text('Search results').css({ fontWeight: 'bold' })
)
.append(
$('<span>').addClass('td-offline-search-results__close-button')
)
);
const $searchResultBody = $('<div>').css({
maxHeight: `calc(100vh - ${
$targetSearchInput.offset().top - $(window).scrollTop() + 180
}px)`,
overflowY: 'auto',
});
$html.append($searchResultBody);
if (results.length === 0) {
$searchResultBody.append(
$('<p>').text(`No results found for query "${searchQuery}"`)
);
} else {
results.forEach((r) => {
r.sub_results.forEach((s) => {
const href = s.url;
const $entry = $('<div>').addClass('mt-4');
$entry.append(
$('<small>').addClass('d-block text-body-secondary').text(r.meta.title)
);
$entry.append(
$('<a>')
.addClass('d-block')
.css({
fontSize: '1.2rem',
})
.attr('href', href)
.text(s.title)
);
$entry.append($('<p>').html(s.excerpt));
$searchResultBody.append($entry);
});
});
}
$targetSearchInput.one('shown.bs.popover', () => {
$('.td-offline-search-results__close-button').on('click', () => {
$targetSearchInput.val('');
$targetSearchInput.trigger('change');
});
});
const popover = new bootstrap.Popover($targetSearchInput, {
content: $html[0],
html: true,
customClass: 'td-offline-search-results',
placement: 'bottom',
});
popover.show();
};
});
})(jQuery);

View file

@ -661,3 +661,8 @@ dd {
margin: 0;
}
}
/* Style for the page search widget */
.td-offline-search-results {
max-width: 460px;
}

View file

@ -1 +1 @@
Add the `is_animated` flag to the `info` object of the `m.image` msgtype and the `m.sticker` event, as per [MSC4230](https://github.com/matrix-org/matrix-spec-proposals/pull/423O).
Add the `is_animated` flag to the `info` object of the `m.image` msgtype and the `m.sticker` event, as per [MSC4230](https://github.com/matrix-org/matrix-spec-proposals/pull/4230).

View file

@ -0,0 +1 @@
Fix various typos throughout the specification.

View file

@ -0,0 +1 @@
Add the `is_animated` flag to the `info` object of the `m.image` msgtype and the `m.sticker` event, as per [MSC4230](https://github.com/matrix-org/matrix-spec-proposals/pull/4230).

View file

@ -0,0 +1 @@
Add page search widget.

View file

@ -0,0 +1 @@
Fix various typos throughout the specification.

View file

@ -66,6 +66,7 @@ description = "Home of the Matrix specification for decentralised communication"
[params]
copyright = "The Matrix.org Foundation C.I.C."
offlineSearch = true
[params.version]
# must be one of "unstable", "current", "historical"
@ -151,7 +152,8 @@ sidebar_menu_compact = true
[server.headers.values]
# `style-src 'unsafe-inline'` is needed to correctly render the maths in the Olm spec:
# https://github.com/KaTeX/KaTeX/issues/4096
Content-Security-Policy = "default-src 'self'; style-src 'self' 'unsafe-inline'; script-src 'self'; img-src 'self' data:; connect-src 'self'; font-src 'self' data:; media-src 'self'; child-src 'self'; form-action 'self'; object-src 'self'"
# TODO: Figure out CSP to allow loading the Pagefind Wasm
#Content-Security-Policy = "default-src 'self'; style-src 'self' 'unsafe-inline'; script-src 'self'; img-src 'self' data:; connect-src 'self'; font-src 'self' data:; media-src 'self'; child-src 'self'; form-action 'self'; object-src 'self'"
X-XSS-Protection = "1; mode=block"
X-Content-Type-Options = "nosniff"
# Strict-Transport-Security = "max-age=31536000; includeSubDomains; preload"

View file

@ -637,7 +637,7 @@ request.
The prompt for Bob to accept/reject Alice's request (or the unsupported method
prompt) should be automatically dismissed 10 minutes after the `timestamp` (in
the case of to-device messages) or `origin_ts` (in the case of in-room
the case of to-device messages) or `origin_server_ts` (in the case of in-room
messages) field or 2 minutes after Bob's client receives the message, whichever
comes first, if Bob does not interact with the prompt. The prompt should
additionally be hidden if an appropriate `m.key.verification.cancel` message is

View file

@ -0,0 +1,10 @@
<div class="td-search td-search--offline">
<div class="td-search__icon"></div>
<input
type="search"
class="td-search__input form-control"
placeholder="{{ T "ui_search" }}"
aria-label="{{ T "ui_search" }}"
autocomplete="off"
>
</div>