Click the structures and reaction arrows in sequence to view the 3D models and animations respectively
This shows the mechanism for pyrrole synthesis based on recent DFT study. Instead of the formation and cyclisation of a enamine intermediate, a hemiaminal intermediate in formed, followed by the consecutive dehydrations of the two hydroxyl groups. The dehydration steps may look familiar: it is just the formation of an enamine
A more traditional approach to the mechanism, which appears in some text books and taught courses, can be found here.
B. Mothana and R. J. Boyd, J. Mol. Struct. THEOCHEM, 2007, 811, 97–107.