|
| 1 | +# Collaborative LaTeX Macro Safety Guard |
| 2 | + |
| 3 | +This module is a self-contained real-time collaborative research editor slice for SCIBASE.AI issue #12. It validates synchronized Markdown and LaTeX editor packets before live preview or named-version export. |
| 4 | + |
| 5 | +The guard uses synthetic data only. It does not connect to live users, private manuscripts, browser sessions, credentials, or external services. |
| 6 | + |
| 7 | +## Scope |
| 8 | + |
| 9 | +- Detect conflicting collaborator macro definitions before broadcast. |
| 10 | +- Block unsafe macro commands such as raw HTML helpers, external links, and image includes unless a trusted render packet is explicitly reviewed. |
| 11 | +- Detect recursive macro expansion cycles that can hang live preview or export rendering. |
| 12 | +- Block raw active HTML and unapproved external render resources inside Markdown/LaTeX blocks. |
| 13 | +- Hold locked sections when unapproved or external-resource macro changes affect the render packet. |
| 14 | +- Emit deterministic remediation actions for live preview, trusted KaTeX rendering, and named-version export gates. |
| 15 | + |
| 16 | +## Requirement Mapping |
| 17 | + |
| 18 | +| Issue #12 area | Implementation | |
| 19 | +| --- | --- | |
| 20 | +| Rich scientific formatting | Macro, equation, Markdown, and external render-resource checks | |
| 21 | +| Real-time collaboration | Multi-user macro conflict and shared render packet validation | |
| 22 | +| Locking/unlock modes | Locked section render holds for risky macro packets | |
| 23 | +| Version history and autosave | Named-version export decisions and reviewer remediation packets | |
| 24 | + |
| 25 | +## Files |
| 26 | + |
| 27 | +- `index.js` - dependency-free evaluator plus Markdown/SVG report renderers. |
| 28 | +- `sample-data.js` - synthetic ready, blocked, and needs-review editor packets. |
| 29 | +- `test.js` - Node assertion coverage for guard decisions and report renderers. |
| 30 | +- `demo.js` - writes deterministic JSON, Markdown, and SVG reviewer artifacts. |
| 31 | +- `scripts/render-demo-video.js` - optional ffmpeg-based MP4 renderer. |
| 32 | +- `reports/` - generated reviewer artifacts. |
| 33 | + |
| 34 | +## Validation |
| 35 | + |
| 36 | +```bash |
| 37 | +npm run check |
| 38 | +npm test |
| 39 | +npm run demo |
| 40 | +``` |
| 41 | + |
| 42 | +Optional video render when ffmpeg is available: |
| 43 | + |
| 44 | +```bash |
| 45 | +npm run demo:video |
| 46 | +``` |
| 47 | + |
| 48 | +The included demo artifacts are deterministic and based only on the synthetic fixtures in `sample-data.js`. |
0 commit comments