Files
FairMQ/docs/scripts/nowrap-code.mjs
Claude 992db82b91 feat(docs): add the documentation site
- Astro and Starlight site in docs/ for
  https://fairrootgroup.github.io/FairMQ/
- 64 pages in eight groups: start, concepts, guides, shared memory,
  examples, tools, reference and project
- API reference and source browser from the Doxygen XML of fairmq/
- Code samples are snippets of the repository files; the build fails
  when a snippet does not match
- Option tables take the names, types and defaults from the code
- Interactive diagrams: state machine, zero-copy transfer, region
  acknowledgements, session objects, topology and channel anatomy
- The 404 page sends the URLs of the Doxygen site to the new pages
- scripts/check-pages.mjs checks pages, snippets and links without a
  build; scripts/check-links.mjs checks all links in dist/

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 01:21:28 +01:00

25 lines
880 B
JavaScript

// Sätteri hast plugin: marks short inline code with the class `nw`, so that the browser does not
// break it at a hyphen. A line break in `--print-options` or `fair::mq::Device` misleads the reader.
// Long inline code can still wrap, so that it fits on a phone.
const MAX = 32;
const textOf = (node) =>
(node.children ?? []).map((c) => (c.type === 'text' ? c.value : textOf(c))).join('');
export default function nowrapCode() {
return {
name: 'fairmq-nowrap-code',
element: {
filter: ['code'],
visit(node, ctx) {
if (ctx.parent?.(node)?.tagName === 'pre') return;
const cls = node.properties?.className ?? [];
if ([].concat(cls).some((c) => String(c).startsWith('language-'))) return;
if (textOf(node).length > MAX) return;
ctx.setProperty(node, 'className', [...[].concat(cls), 'nw']);
},
},
};
}