The "Dark Ages" were just in Western Europe. The Eastern Roman Empire, based in Constantinople, kept going, and preserved much of Greek and Roman knowledge. It was just unavailable to Western Europe for much of this time due to Islamic piracy making sea commerce difficult.
So many people forget the thousand year run of the Byzantine world. I find it fascinating.