update: probably mermaid is good enough, you can use it in various markdown editors, such as hackmd. Otherwise, for print, see my origina answer below.
This answers is maybe not exactly what you had in mind, so let me shortly give a context.
Over the years I've come to appreciate literate programming as a super nice way to write quality software and keep that code comprehensible. Maybe the only way... In any case, sequence diagrams, being visual, nicely complement code and writing. This facilitates understanding.
LaTeX / PGF / pgf-umlsd / noweb
So for this purpose, LaTeX + pgf-umlsd can create very good looking diagrams. They are specified semantically, like most other tools, meaning you say what sequence you what, not how it should look. The program computes the right picture.
So this LaTeX code
\documentclass{article}
\usepackage{tikz}
\usepackage{pgf-umlsd}
\begin{document}
\begin{sequencediagram}
\newthread{t}{:Thread}
\newinst[1]{i}{:Instance}
\begin{sdblock}{Block}{description}
\begin{call}{t}{function()}{i}{}
\end{call}
\end{sdblock}
\end{sequencediagram}
\end{document}
creates this picture (of course using the fonts of the rest of your document, etc.):
In the LaTeX source the relevant bits of executable code are just below the diagram,
keeping things together. I use noweb
(site, docs) to get the runnable code or the source for the article.
HTH.