A nanoporous borocarbonitride (BC4N) with novel properties derived from a boron-imidazolate-based metal-organic framework.