The construction of fluorescent heteropore covalent organic frameworks and their applications in spectroscopic and visual detection of trinitrophenol with high selectivity and sensitivity.