Repository navigation
Releases
v0.10.3
v0.10.2
0.10.2: the layout settles faster with the same look, v1 is gone, one…
v0.10.1
v0.10.0
v0.9.5
0.9.4
Feynjs
Feynman diagrams have lived in TeX. To show one on a web page, in documentation or in a Markdown note, you drew it in TikZ-Feynman, placing each vertex by hand, compiled it, and pasted in an image. That image no longer matched its source, the page's colours or the paper, and every change meant doing it again.
feynjs draws Feynman diagrams from text, where they are read. You write the diagram, its lines or just the process (p p > t tbar), and feynjs places every vertex itself. Time runs left to right; s- and t-channels, decay cascades, loops and hadrons come out as published diagrams draw them; each particle sets its own line, arrow and label. It is JavaScript, so the browser draws the diagram as SVG in the page, in the page's colours. The same source gives TikZ-Feynman code for a TeX document. A diagram is written once, and reads the same on a web page, in a Markdown site or note, and in a paper.
p p > t tbar
t > b W+(> e+ nu)
tbar > bbar W-(> q qbar)
New in 0.9.4
LaTeX package. Diagrams written in feynjs syntax inside a LaTeX document; feynjs cache writes each as TikZ-Feynman code with every vertex placed. It compiles anywhere TikZ-Feynman does, including Overleaf and arXiv (PDF and HTML).
Identical layouts on every platform. The same diagram on ARM and x86, in Node, Deno, Bun, Chrome, Firefox and Safari, so a web page, a note and a paper show the same picture.
TikZ output that matches the SVG: lines, waves, arrows, label positions, hadrons.
MadGraph plugin. mg5_aMC --mode=feynjs, then feynjs DIR, draws every diagram of a generated process, decay chains joined.
Playground on the docs site: edit, drag, draw, and export SVG, PNG or TikZ.
Layout:
a top's b, and the light partner of any heavy fermion, short and to the outside;
a stop's top short; incoming lines converge or run level; mirror-image diagrams exactly mirrored; crowded labels moved clear;
debug: on shows which rules place each line.
Syntax: detector objects in processes, with their contents (LRJ(1b W(2j))); particle names in any case; inline: for diagrams in running text.
Data: every part of the SVG named, the diagram embedded as JSON, and diagrams accepted as data as well as text.
Use it
Web page: <script src="https://cdn.jsdelivr.net/npm/feynjs@0.9/dist/feynjs.min.js"></script>; a feynman code block or
Markdown: Zensical or MkDocs sites, and Obsidian (feynjs-obsidian.zip below).
TeX: integrations/latex/feynjs.sty with feynjs cache.
JavaScript: npm install feynjs; command line feynjs.
MadGraph: feynjs-madgraph.zip below.
Documentation and playground: https://hepjs.github.io/feynjs/
All changes, and the approved layouts that moved: CHANGELOG.md.