Tailored formation of N-doped nanoarchitectures by diffusion-controlled on-surface (cyclo)dehydrogenation of heteroaromatics.