Two fluorescent covalent organic frameworks (COFs) which bear two kinds of pores with different sizes and shapes have been synthesized. The heteropore COFs exhibit spectroscopic and color changes to 2,4,6-trinitrophenol (TNP) with extremely high selectivity and sensitivity, which makes them excellent macroscopic chemosensors for the selective detection of TNP.