The Hahn-Mazurkiewicz theorem and its elegant generalization