Maintaining layout of Tikz diagrams with TeX4ht (converting as single pictures)
There is specialized output driver for use with tex4ht in Tikz. Using it, diagrams are saved in SVG.
\documentclass{article}
\def\pgfsysdriver{pgfsys-tex4ht.def}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\path (0,0) node[draw] (A) {A};
\path (2,0) node[draw] (B) {B};
\draw (A) -- (B) node[midway,above = 0 em] {via};
\end{tikzpicture}
\end{document}