Files
libretro/website/src/components/MarkdownContent.astro
T
Abdessamad Derraz e14f935994 feat: short code marks, lazy search, index fields
Inline code of 30 characters or fewer is marked rb-short at build time and the options table rb-options. The search UI loads on first use. Title, crumbs and footer leave the search index, and consoles and terms weigh as a title.
2026-10-23 19:06:08 +02:00

62 lines
2.3 KiB
Plaintext

---
// Search weight: Pagefind multiplies the score of words inside a weighted
// element, so a Start here page outranks the reference page that names it,
// and an emulator outranks its launcher or its frozen copy.
import Default from '@astrojs/starlight/components/MarkdownContent.astro';
const { searchWeight } = Astro.locals.starlightRoute.entry.data;
---
{
searchWeight ? (
<div data-pagefind-weight={String(searchWeight)}>
<Default><slot /></Default>
</div>
) : (
<Default><slot /></Default>
)
}
<script>
import '../scripts/site.ts';
</script>
<!-- Global: the lookup form on files/ is written by the generator. Its input
keeps to the column on a phone (size="66" made it 707 px wide). -->
<style is:global>
.sl-markdown-content .rb-file-lookup input {
width: 100%;
min-width: 0;
max-width: 40rem;
box-sizing: border-box;
}
/* The file chooser site.ts adds under the form, and the four hashes it
shows once the file is read. */
.sl-markdown-content .rb-file-pick { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.35rem; margin-top: 1rem; }
.sl-markdown-content .rb-file-pick > * { margin: 0; }
.sl-markdown-content .rb-file-pick label { font-weight: 600; }
.sl-markdown-content .rb-file-pick input { width: 100%; min-width: 0; font: inherit; }
.sl-markdown-content .rb-file-pick input::file-selector-button {
min-height: 44px;
margin-inline-end: 0.75rem;
padding: 0 1rem;
border: 1px solid var(--rb-border-strong);
border-radius: 4px;
background: var(--sl-color-bg);
color: var(--sl-color-text);
font: inherit;
font-weight: 600;
cursor: pointer;
}
.sl-markdown-content .rb-file-pick-note { color: var(--sl-color-gray-3); font-size: var(--sl-text-sm); }
.sl-markdown-content .rb-file-pick-hashes code { overflow-wrap: anywhere; }
.sl-markdown-content .rb-file-pick-hashes[hidden] { display: none; }
/* On touch the copy button is always shown, and it covered the end of a
command's first line. A titled frame (Terminal, PowerShell) has a
header row with room on its right: the button sits there. */
@media (pointer: coarse) {
.expressive-code .frame.has-title .copy { inset-block-start: calc(var(--ec-brdWd) + 0.0625rem); }
.expressive-code .frame.has-title .copy button { width: 2rem; height: 2rem; }
}
</style>