The quest for new materials with extraordinary electronic, magnetic, and optical properties leads to the synthesis of 2D nitrogenated microporous materials with the hole diameter of 1.16 nm. We computationally study the evolution of the energy bandgaps, optical, and transport properties with the following substituents: hydrogen, fluorine, chlorine, and iodine. We find that such a small perturbation by these atoms has a tremendous impact on the electronic properties of these materials. Indeed, the direct energy bandgaps can be tuned from 1.64 to 0.96 eV by the substituents from hydrogen to iodine. The optical gaps demonstrate similar dependence. From the transport properties, we calculate the effective masses of π-conjugated microporous polymers and find that the conduction electron effective masses are insensitive to halogen substituents while for some lowlying energy valence bands the effective masses can be drastically increased from 0.71 to 2.98me and 0.28 to 0.58me for the heavy and light holes, respectively. The application of the nitrogenated microporous materials is very broad. They can be useful as sensitizers in solar cells, for water splitting catalysis, in biomedicine, and for gas and energy storage. [ABSTRACT FROM AUTHOR]