FeynmanJS comes with a $\LaTeX$-based parser out of the box, however it is extendable and you can write your own plugin.
FeynmanJS will try to figure out the best possible layout for your diagram without any manual fiddling with pixel coordinates etc.
Diagrams are drawn with SVG meaning they scale well on all devices.
Just insert a new block element where you would like your diagram to be rendered to; then assign the feynmanjs
class to to that element.
<div class="feynmanjs"></div>
Next, add some diagram code in JSON.
<div class="feynmanjs">
{
"title" : "Box diagram",
"width" : 400,
"height" : 270,
"diagram": [
"fmfleftn{2}",
"fmfrightn{2}",
"fmf{fermion}{o1,v2,v1,i1}",
"fmf{fermion}{i2,v3,v4,o2}",
"fmf{photon}{v1,v3}",
"fmf{photon}{v2,v4}"
]
}
</div>
All is left is to include Feynman and instantiate it
<script src="/js/feynman.min.js"></script>
<script>
var feynman = new Feynman();
</script>