A multifunctional chemical toolbox to engineer carbon dots for biomedical and energy applications