Strategies for fabricating versatile carbon nanomaterials from polymer precursors