Carbon nanothreads are a new one-dimensional sp3 carbon nanomaterial. They assemble into hexagonal crystals in a room temperature, nontopochemical solid-state reaction induced by slow compression of benzene to 23 GPa. Here we show that pyridine also reacts under compression to form a well-ordered sp3 product: C5NH5 carbon nitride nanothreads. Solid pyridine has a different crystal structure from solid benzene, so the nontopochemical formation of low-dimensional crystalline solids by slow compression of small aromatics may be a general phenomenon that enables chemical design of properties. The nitrogen in the carbon nitride nanothreads may improve processability, alters photoluminescence, and is predicted to reduce the bandgap.