Friends, I've been successfully using the tocloft package to manage custom indices. But now I have some doubts on a tricky part, whether is possible or not. Consider the following code:
\documentclass{article}
\usepackage[titles]{tocloft}
\usepackage{tikz}
\newcommand*\info[1]{%
\begin{tikzpicture}
\node[draw,inner sep=1pt, minimum height=0.2cm, minimum width=0.5cm] {\tt\tiny #1};
\end{tikzpicture}}
\newcommand{\listfoo}{List of foo}
\newlistof[section]{foo}{idf}{\listfoo}
\begin{document}
\info{123} \info{ABC} Hello world.
\refstepcounter{foo}
\addcontentsline{idf}{foo}{Hello world.}
\refstepcounter{foo}
\addcontentsline{idf}{foo}{Hello bar.}
\listoffoo
\end{document}
The output is as expected:

In this particular case, I was wondering if it's possible to add a TikZ image to the list entries. I tried to add \addcontentsline{idf}{foo}{\info{123} \info{ABC} Hello world.} but it didn't work. I hope to achieve something like this:

I also tried the inline \tikz, but no success. Probably I'm missing something obvious, or maybe it's trickier than I thought. Any ideas?