Zensical and MkDocs¶
A docs site: every feynman block in your Markdown becomes a diagram.
-
Load the script. Add feynjs to the page scripts, in the
[project]table: -
Add the fence. It keeps a
feynmanblock as written. Without it, the highlighter turns the block into plain text and feynjs can't find it. If you already listcustom_fences(for Mermaid, say), add the line to that list. -
Write a diagram in any page, in a
feynmancode block:
feynjs draws the blocks once a page has loaded, and again after each instant page change.
Demo¶
This block, in a page of this site:
draws this diagram:
Diagrams draw in currentColor, so they follow the light and dark palettes without being drawn
again. A block can hold a process instead of edges:
Without the CDN¶
Download feynjs.min.js once, from the latest release or from the npm package:
curl -L -o feynjs.min.js https://github.com/hepjs/feynjs/releases/latest/download/feynjs.min.js
# or: npm install feynjs, then copy node_modules/feynjs/dist/feynjs.min.js
It is one file of about 350 KB, with no dependencies, so it works with no network: behind a firewall, offline, or on a site that loads nothing from other servers. To update, download it again.
Put it in docs/javascripts/ and list it in place of the CDN link (the path is relative to
docs/):
The site then carries its own copy, built and published with it.
Optional extras¶
Your own options. To pass options to every diagram (a download button, say), call run
yourself from a small script listed after feynjs; feynjs leaves what you have drawn alone:
run takes every option in the JavaScript API.
Next¶
- Your first diagram: what each line of a diagram means.
- Write edges, as in TikZ-Feynman or write processes, as in MadGraph.
- Examples: hundreds of diagrams with their source.