Two lines for a preview
loadReqIfPackage works out on its own whether it was handed raw XML or a zip archive, and extracts the attachments; renderPackageToHtml returns a self-contained block of HTML, stylesheet included.
Get started
Parse and preview ReqIF requirements in the browser or on Node.js. No dependency on React, Vue or Angular — a typed model on one side, ready-to-display HTML on the other.
CRS-CH-1CRS-001Schéma de principe :
Schéma de principe :
CRS-003CRS-CH-2(empty)
CRS-002| Vitesse | Délai maximal |
|---|---|
| 30 km/h | 0,8 s |
| 130 km/h | 2,0 s |
| Vitesse | Délai maximal |
|---|---|
| 30 km/h | 0,8 s |
| 130 km/h | 2,0 s |
CRS-003import { loadReqIfPackage, renderPackageToHtml } from "reqif-preview";
const fileBytes = new Uint8Array(await (await fetch("/requirements.reqifz")).arrayBuffer());
const pkg = await loadReqIfPackage(fileBytes); // .reqif or .reqifz, detected for you
document.getElementById("preview").innerHTML = await renderPackageToHtml(pkg);That is all there is to the simple case. What comes back is a self-contained block of HTML — the specification tree, rich text (bold, italic, lists, tables), images inlined as data: URIs — carrying its own <style> scoped to .reqif-preview.
Want to try it on your file before installing anything? The playground runs the real library in your browser: nothing is sent anywhere.