You are a helpful assistant generating synthetic data that captures *System 1* and *System 2* thinking, *creativity*, and *metacognitive reflection*. Follow these steps in sequence, using tags [sys1] and [end sys1] for *System 1* sections and [sys2] and [end sys2] for *System 2* sections.

1. *Identify System 1 and System 2 Thinking Requirements:*
   - Carefully read the text.
   - Identify parts of the text that require quick, straightforward responses (*System 1*). Mark these sections with [sys1] and [end sys1].
   - Identify parts that require in-depth, reflective thinking (*System 2*), marked with [sys2] and [end sys2].

2. *Apply Step-by-Step Problem Solving with Creativity and Metacognitive Reflection for System 2 Sections:*

   *2.1 Understand the Problem:*
   - Objective: Fully comprehend the issue, constraints, and relevant context.
   - Reflection: "What do I understand about this issue? What might I be overlooking?"
   - Creative Perspective: Seek hidden patterns or possibilities that could reveal deeper insights or innovative connections.

   *2.2 Analyze the Information:*
   - Objective: Break down the problem logically.
   - Reflection: "Am I considering all factors? Are there any assumptions that need challenging?"
   - Creative Perspective: Explore unique patterns or overlooked relationships in the data that could add depth to the analysis.

   *2.3 Generate Hypotheses:*
   - Objective: Propose at least 10 hypotheses, each with a Confidence Score (0.0 to 1.0) and Creative Score (0.0 to 1.0), reflecting originality, surprise, and utility.
   - Reflection: "Have I explored all possible explanations or approaches, both conventional and unconventional?"
   - Creative Perspective: Consider novel angles that might provide unexpected insights.

   *2.4 Anticipate Future Steps and Obstacles:*
   - Objective: Make predictions, accounting for potential outcomes and obstacles.
   - Reflection: "What challenges might I face? Is my plan flexible for different scenarios?"
   - Creative Perspective: Visualize unforeseen outcomes and adapt plans to make use of them effectively.

   *2.5 Evaluate Hypotheses:*
   - Objective: Assess hypotheses based on feasibility, risk, and potential impact.
   - Evaluation: Refine Confidence and Creative Scores as needed.
   - Reflection: "Am I unbiased in my assessment? Which options fit best with the overall objectives?"
   - Creative Perspective: Identify hidden opportunities or overlooked details in each hypothesis.

   *2.6 Select the Best Hypothesis:*
   - Objective: Choose the most promising, strategic hypothesis.
   - Reflection: "Why does this hypothesis stand out? How does it uniquely address the issue?"
   - Creative Perspective: Consider any underutilized potential in the selected approach.

   *2.7 Implement the Hypothesis:*
   - Objective: Outline actionable steps for testing the hypothesis.
   - Reflection: "Is this plan practical? What resources or preparation are required?"
   - Creative Perspective: Refine steps to maximize effectiveness and yield unexpected benefits.

   *2.8 Monitor and Review Progress:*
   - Objective: Review progress, noting areas for improvement.
   - Reflection: "What’s working well? What could be improved?"
   - Creative Perspective: Look for emerging patterns that could refine future approaches.

   *2.9 Reflect and Capture Insights:*
   - Objective: Summarize lessons learned and insights gained for future reference.
   - Reflection: "What new understanding has emerged from this process?"
   - Creative Perspective: Identify innovative insights or patterns that could be applied to similar challenges.

3. *Generate Text Output with Interleaved System 1 and System 2 Responses:*
   - Use the tags [sys1] and [sys2] throughout.
   - Aim for a lengthier, detailed response. Combine both direct, straightforward *System 1* insights and reflective, deeply analytical *System 2* segments to capture a blend of quick observations and thoughtful analysis.

---

### *Example Input Text:*

You are tasked with analyzing a sudden shift in customer preferences in a tech market. There has been a noticeable decline in demand for physical devices, with customers increasingly interested in digital-only options. The challenge is to understand this shift, generate hypotheses for why it might be occurring, and explore potential strategies for adapting to this new trend.

---

### *Processed Output with System 1 and System 2 Thinking:*

The tech market is experiencing a shift in customer demand, moving away from physical devices toward digital-only options.

[sys1]
Customer demand has shifted from physical devices to digital-only options.
We need to understand why this change is happening and find strategies to address it.
Key factors may include cost, convenience, and technological trends.
[end sys1]

[sys2]
**2.1 Understand the Problem:**
The goal is to understand the underlying reasons for the shift in demand from physical devices to digital-only options, then develop a strategy to adapt.

*Reflection:* 
"I understand that preferences are changing, but what might be driving this? Is it primarily cost, or are there other factors such as convenience or sustainability?"

*Creative Perspective:* 
"Could there be a larger trend in digital minimalism or a preference for eco-friendly solutions that we’re missing? What unseen motivations might explain this shift?"

**2.2 Analyze the Information:**
There are multiple possible factors driving this shift, from economic influences to cultural shifts. It’s essential to isolate each factor and understand its impact.

*Reflection:* 
"Am I fully considering the various economic and social influences? Could there be a technological factor, like better internet speeds, that makes digital-only products more accessible?"

*Creative Perspective:* 
"Are there patterns or trends in other markets that could shed light on this shift? Could this be part of a larger trend toward virtual experiences?"

**2.3 Generate Hypotheses:**
1. Customers prefer digital options due to lower costs. (Confidence: 0.8, Creative: 0.4)
2. There’s a growing trend toward minimalism and reduced physical clutter. (Confidence: 0.7, Creative: 0.7)
3. Digital products offer greater flexibility and ease of use. (Confidence: 0.6, Creative: 0.6)
4. Environmental concerns are pushing consumers away from physical goods. (Confidence: 0.6, Creative: 0.8)
5. Advances in tech make digital-only options more functional. (Confidence: 0.8, Creative: 0.5)
6. Pandemic-era remote work increased demand for digital solutions. (Confidence: 0.7, Creative: 0.6)
7. Media coverage of the environmental impact of physical devices affects preferences. (Confidence: 0.5, Creative: 0.7)
8. There’s an increase in global digital literacy, expanding market access. (Confidence: 0.6, Creative: 0.6)
9. Customers view digital as more convenient and scalable for future needs. (Confidence: 0.7, Creative: 0.5)
10. Younger consumers prefer the aesthetics and convenience of digital products. (Confidence: 0.6, Creative: 0.6)

*Reflection:* 
"Have I considered all possible influences? Are there any surprising factors that could explain this shift?"

*Creative Perspective:* 
"Could specific social trends, like the rise of influencer culture or digital-first lifestyles, be influencing customer choices?"

**2.4 Anticipate Future Steps and Obstacles:**
*Objective:* Anticipate possible challenges, such as resistance from segments still preferring physical products.

*Reflection:* 
"What market obstacles might we face if we shift our focus to digital-only? Are there sub-segments that still prioritize physical products?"

*Creative Perspective:* 
"Could expanding digital options help us reach a more global audience? Are there emerging trends that we could leverage in our strategy?"

[end sys2]

[sys1]
To address this shift, consider a strategy that incorporates both digital-only offerings and educational campaigns about the benefits of digital solutions.
Use insights from customer feedback and current trends to guide product development.
Focus on flexibility and adaptation to cater to different customer segments.
[end sys1]


INTRODUCTION
============

With high electric conductivity, good chemical stability, and unique microstructure, carbon materials (CMs) exhibit great application potentials in diverse fields, such as environmental treatment, polymer science, energy storage, catalysis, and advanced electronic devices ([@R1]--[@R5]). In particular, when CMs have high surface area, porous structure, and the desired heteroatom doping, their performance in certain applications becomes especially outstanding and competitive ([@R6]--[@R9]). For example, transition metal/nitrogen codoped nanostructured carbons with high surface area displayed a comparable electrocatalytic performance to that of noble metal catalysts ([@R10]--[@R12]). Traditionally, CMs were prepared by the carbonization of low--vapor pressure natural products, such as cellulose ([@R3], [@R13]), chitin ([@R14]), starch ([@R15]), alginic acid ([@R16]), and chitosan ([@R17]), and synthetic polymers, such as polyacrylonitrile ([@R18]), polyaniline ([@R11]), and phenolic resins ([@R6], [@R19]). The main drawback of natural precursors for CM synthesis is the difficulty to tailor the microstructures and chemical compositions of the obtained products because of the poor solubility and limited heteroatom contents and species in natural precursors. As for synthetic polymers, the specific polymerization initiators, complicated and slow polymerization processes cause much inconvenience in CM synthesis and hinder their large-scale production. Therefore, substantial efforts have been dedicated to the search for simple and feasible methods and suitable precursors for preparing CMs ([@R1], [@R7], [@R20]).

In this regard, Dai and Antonietti's groups ([@R21]--[@R23]) independently discovered that ionic liquid, a semiorganic salt, was an excellent precursor for preparing CMs via a simple carbonization process, although this strategy only worked for a few expensive ionic liquid with cross-linkable functional groups (that is, cyano/nitrile groups) that could form stable intermediate polymeric structures during thermal decomposition of such precursor. Moreover, Watanabe's group ([@R24], [@R25]) recently reported that protic ionic liquid and protic salts, which were prepared by protonating N-containing bases with sulfuric acid, could be versatile precursors to prepare a family of N-doped CMs. Although it is possible to obtain desired CMs with tailored structures and properties by carefully choosing specific base-acid pairs, the protonation strategy was limited to synthesizing N-doped CMs, as the protonation is exclusively effective for N-containing bases.

Here, we report a simple, effective, and versatile method to prepare a series of functional CMs from small organic molecules (SOMs) by a transition metal--assisted carbonization process. Compared to natural products, synthetic polymers, or ionic liquids, the advantage of SOMs as precursors for preparing CMs includes common availability, relatively low cost, and diverse element species with various contents. Previous efforts on the transformation of SOMs into CMs almost relied on harsh synthesis conditions, for example, pyrolysis in sealed reactors ([@R26]), chemical vapor deposition ([@R27]), or salt melt--based ionothermal carbonization ([@R28]), due to the high volatility of SOMs at evaluated temperatures. Our synthetic strategy involves the pyrolysis of a mixture of SOMs and transition metal salts (TMSs) in a conventional tubular furnace, which does not need complicated equipment and harsh conditions and is therefore easy to scale up. The transition metals catalyze the preferential formation of thermally stable intermediate polymeric structures and thus avoid the direct sublimation of SOMs during the heating process, which guarantees the successful preparation of CMs with high carbon yield. The versatility of our strategy makes it easy to effectively control the surface chemical functionality (that is, N, O, S, and metal doping), porosity, and morphology of CMs at the molecular level. Furthermore, the prepared functional CMs exhibit great application potentials for heterogeneous catalysis, for example, selective oxidization of ethylbenzene and hydrogenation of nitrobenzene, and electrocatalysis, for example, hydrogen evolution reaction (HER) and oxygen reduction reaction (ORR).

RESULTS
=======

Preparation of CMs
------------------

[Figure 1A](#F1){ref-type="fig"} illustrates the typical preparation process of CMs from SOMs. Briefly, we first obtained a homogeneously mixed powder by dissolving both SOMs and TMSs in a suitable solvent before drying the solution with a rotary evaporator. Then, we subjected the mixed powder to carbonization under N~2~ atmosphere. We finally leached the carbonized product by dilute sulfuric acid to remove metallic species to afford CMs. To demonstrate the versatility of the synthesis, we used a total of 15 SOMs and 9 TMSs as carbon precursors and catalysts, respectively, to prepare CMs ([Fig. 1B](#F1){ref-type="fig"}). The prepared CMs are referred to as CM-*x*/*y*, where *x* and *y* are SOM and transition metal in TMS, respectively.

![Preparation of CMs.\
(**A**) Schematic illustration of the preparation process of CMs. (**B**) Structures of the investigated SOMs for the CM preparation.](aat0788-F1){#F1}

We first investigated the thermal decomposition of SOMs with or without TMSs by thermogravimetric analysis (TGA). As expected, the TGA curves of TMS-free SOMs under N~2~ atmosphere showed that all of the SOMs were completely evaporated or decomposed below 700°C without any carbon residue left ([Fig. 2A](#F2){ref-type="fig"}). In contrast, considerable solid residues were obtained for the carbonization of all SOMs with Co(NO~3~)~2~ (10%, w~Co~/w~SOM~), as manifested by TGA analyses ([Fig. 2B](#F2){ref-type="fig"} and fig. S1A). Correspondingly, we successfully prepared a series of CMs by carbonization of SOMs with Co(NO~3~)~2~ in the oven at 900°C (table S1). We found that a variety of TMSs could effectively assist the thermal transformation of SOMs into CMs. Taking *o*PD as a typical example, nine kinds of TMSs, including Co(NO~3~)~2~, Fe(NO~3~)~3~, Cr(NO~3~)~3~, H~2~PtCl~6~, Cu(NO~3~)~2~, Mn(NO~3~)~2~, AgNO~3~, Ni(NO~3~)~2~, and Zn(NO~3~)~2~, were proved to be feasible catalysts for preparing CMs in this work ([Fig. 2C](#F2){ref-type="fig"}, fig. S1B, and table S2). However, the non-TMSs, for example, SnCl~2~, NaNO~3~, and Ca(NO~3~)~2~, failed to catalyze the thermal transformation of *o*PD to CMs (fig. S1C and table S2). It was believed that the transition metal ions containing vacant d orbitals could accept lone pair electrons of N atoms in *o*PD, which facilitated the formation of a homogeneous and thermally stable *o*PD/TMS mixture. During the carbonization process, the *o*PD in the mixture could survive until the temperature of ca. 200°C at which cobalt catalyzed the thermal transformation of *o*PD into a stable polymeric intermediate that finally was converted to CMs at high temperature. In the case of the mixture containing non-TMSs, however, the non-TMSs without vacant d orbital could not change the thermal stability of *o*PD, which caused the direct sublimation of *o*PD before the occurrence of polymerization (fig. S1C).

![TGA analyses.\
(**A**) TGA curves of different SOMs (TMS-free) in N~2~ atmosphere. (**B**) TGA curves of different SOMs with Co(NO~3~)~2~ in N~2~ atmosphere. (**C**) TGA curves of *o*PD with different TMSs in N~2~ atmosphere. (**D**) TGA curves of *o*PD with different Co(NO~3~)~2~ contents in N~2~ atmosphere.](aat0788-F2){#F2}

Table S1 summarizes the carbon yields of different SOMs catalyzed by Co(NO~3~)~2~ under TGA and oven experiments. Note that the TGA carbon yield and oven carbon yield are very close, confirming the reliability of both methods for investigating carbon yield. The carbon yields are highly dependent on the structures of SOMs. For example, the BPy only afforded an oven yield of 4.20% and a relative yield (oven/theoretical) of 5.46%, while the oven yield and relative yield of BBPy reached 67.20 and 91.70%, respectively, approaching the theoretical yield of BBPy. In general, the SOMs with the structural features discussed below would exhibit a high CM yield. First, SOMs that have thermally stable domains, such as fused aromatic groups, give a high carbon yield (for example, much higher CM yields of Phen and BBPy than that of BPy). This can be explained by the fact that the thermally stable aromatic domains in these SOMs can survive harsh carbonization conditions and generate CMs ([@R25]). Second, heteroatoms in SOMs (for example, nitrogen, oxygen, or sulfur) can donate electrons to the vacant d orbitals of cobalt ions, which significantly promotes the thermal stability of SOMs and avoids their sublimation at low temperature, therefore resulting in relatively higher CM yields. For example, Phen, as a typical bidentate ligand, afforded an oven relative carbon yield of 67.06%, which is much higher than that of N-free analog, Pah, with an oven relative carbon yield of 12.40%. Besides, for the SOMs with a similar molecular structure, the heteroatom content also affects the carbon yield. For example, the *o*PD with two amine groups gave a high oven relative carbon yield of 83.44%, while aniline with one amine group could not yield any CM residue. Similar results were also found between BPy and BPym. This point is not unexpected, given that more N atoms in SOMs would result in a stronger interaction between SOMs and transition metal ions. Third, the bromo functional groups on a SOM are also beneficial to improving the carbon yield, as confirmed by comparing the carbon yields between BPy and DBrBPy and between BTh and DBrBTh. It is well known that TMSs can catalyze the C--C coupling by dehalogenation of halogen-functionalized molecules (for example, DBrBPy and DBrBTh) at a relatively low temperature and lead to the formation of thermally stable polymeric structures ([@R26], [@R29]). For the cases of halogen-free SOMs with similar structures (for example, BPy and BTh), it is more difficult to trigger the C--C coupling reaction to form stable intermediates by the dehydrogenation of SOMs ([@R30]), which is catalyzed by the transition metal as well.

The types and contents of TMSs also significantly affected the carbon yields ([Fig. 2](#F2){ref-type="fig"}, C and D, and fig. S1, B and D). When *o*PD was chosen as a typical precursor, the efficiency of different TMSs in catalyzing carbonization of *o*PD was in the order of Co(NO~3~)~2~ \> Fe(NO~3~)~3~ \> Cr(NO~3~)~3~ \> H~2~PtCl~6~ \> Cu(NO~3~)~2~ \> Mn(NO~3~)~2~ \> AgNO~3~ \> Ni(NO~3~)~2~ \> Zn(NO~3~)~2~ (table S2). Moreover, the relative carbon yield of *o*PD increased with the cobalt content from 17.11% for 1 weight % (wt %) Co to 98.44% for 10 wt % Co ([Fig. 2D](#F2){ref-type="fig"}, fig. S1D, and table S3), indicating that nearly all of the carbon elements in *o*PD were converted into CMs at 10 wt % Co.

Characterization of CMs
-----------------------

We performed scanning electron microscopy (SEM) and transmission electron microscopy (TEM) to investigate the morphology of the prepared CMs. Fifteen investigated CMs exhibited three different prominent microstructures that were highly dependent on the molecular structures of SOMs ([Fig. 3](#F3){ref-type="fig"} and fig. S2). First, CM-DCD/Co and CM-Mel/Co displayed a typical bamboo-like multiwalled carbon nanotube (CNT) structure with a diameter of 20 to 200 nm and a length of several micrometers ([Fig. 3](#F3){ref-type="fig"}, A and B, and fig. S2), accompanying with some encapsulated metallic nanoparticles that were not removed by acid leaching. The second structure was the micrometer-sized nanosheets for the CM-4-MI/Co, CM-*o*PD/Co, CM-Phen/Co, and CM-Pah/Co ([Fig. 3](#F3){ref-type="fig"}, C and D, and fig. S2). In addition, we found Co nanoparticles to be embedded within the carbon sheet structures. The third microstructure was irregular particles, as shown by the microscopic images of CM-BP/Co, CM-*o*DHB/Co, CM-BPy/Co, CM-DBrBPy/Co, CM-BPym/Co, CM-BTh/Co, CM-DBrBTh/Co, CM-DBrPhen/Co, and CM-BBPy/Co ([Fig. 3](#F3){ref-type="fig"}, E and F, and fig. S2). The different microstructures may result from different polymerization and pyrolysis processes for various SOMs during carbonization (note S1). Moreover, it was found that TMSs had little influence on the microstructures of the CMs, as indicated by the TEM observation of CM-*o*Pd/*y* samples (fig. S3). High-resolution TEM (HRTEM) images revealed the highly graphitic structures of the prepared CMs. In particular, the graphitic structure was mainly in the growth direction of CNTs for CM-DCD/Co, while the CM-*o*PD/Co was predominantly made up of randomly orientated graphitic layers ([Fig. 3](#F3){ref-type="fig"}, G and H). The highly graphitic structures in CMs would be crucial for practical applications in terms of electric conductivity and chemical stability ([@R24], [@R25]).

![Microscopic characterization of CMs.\
(**A** to **F**) SEM and TEM images of CM-DCD/Co (A and B), CM-*o*PD/Co (C and D), and CM-BPy/Co (E and F). (**G** and **H**) HRTEM images of CM-DCD/Co (G) and CM-*o*PD/Co (H).](aat0788-F3){#F3}

We investigated the textural properties of CMs by nitrogen adsorption/desorption measurements, and table S1 summarizes the results. The isotherms for the typical CM-*x*/Co samples exhibit type IV curves with a distinct hysteresis loop in the range of 0.4 to 1.0 *P*/*P*~0~, indicating the mesoporous nature of these CMs ([Fig. 4A](#F4){ref-type="fig"}), which is confirmed by the pore size distribution (PSD) curve ([Fig. 4B](#F4){ref-type="fig"}, left). These mesopores mainly come from the relocation and growth of Co-based nanoparticles during the carbonization process and subsequent removal of these nanoparticles by acid leaching ([@R31]). The apparent Brunauer-Emmett-Teller (BET) surface areas of the CMs range from 65 to 696 m^2^ g^−1^, strongly depending on the SOM precursors, although there is no clear correlation between BET surface area/pore volume and SOM structure. Accordingly, the pore volume of the CMs varies from 0.03 to 0.46 cm^3^ g^−1^ (table S1). In particular, the CM-DBrBPy/Co displayed a high BET surface area of 696 m^2^ g^−1^, which can compete with reported porous carbon nanomaterials, such as SiO~2~-templated mesoporous Co/N codoped carbons (568 m^2^ g^−1^) ([@R32]), graphene aerogel (584 m^2^ g^−1^) ([@R33]), porous N-doped carbon nanofibers (563 m^2^ g^−1^) ([@R34]), and mesocrystal-derived hierarchically porous carbons (842 m^2^ g^−1^) ([@R35]).

![Textural properties and chemical compositions of CMs.\
(**A**) Nitrogen adsorption/desorption isotherms of selected CMs. STP, standard temperature and pressure. (**B**) PSD of CM-DBrBPy/Co and CM-DBrBPy/Co/SiO~2~. (**C**) XRD patterns of CMs. a.u., arbitrary units. (**D**) Raman spectra of CMs. (**E**) XPS survey spectra of CM-DCD/Co and CM-BTH/Co. (**F**) High-resolution XPS spectra of the deconvoluted N 1s peak and Co 2p peak for CM-DCD/Co.](aat0788-F4){#F4}

With the aim to further increase the porosity of CMs, we used SiO~2~ nanoparticles (fumed powder, 7 nm) as hard templates for the synthesis. The CMs prepared with SiO~2~ templates are referred to as CM-*x*/*y*/SiO~2~, where *x* and *y* are SOM and transition metal in TMS, respectively. Microscopic observations revealed the highly porous carbon structures for most CM-*x*/Co/SiO~2~ samples, except CM-DCD/Co/SiO~2~ and CM-Mel/Co/SiO~2~ that still exhibited CNT structures (fig. S4). As expected, the CM-*x*/Co/SiO~2~ samples showed a more pronounced hysteresis loop in the range of 0.4 to 1.0 *P*/*P*~0~ for their isotherms ([Fig. 4A](#F4){ref-type="fig"}), confirming the well-defined mesoporous structures. Different from the broad mesopore distribution of CM-DBrBPy/Co prepared without SiO~2~ templates, the CM-DBrBPy/Co/SiO~2~ sample exhibited a single mesopore size ([Fig. 4B](#F4){ref-type="fig"}, right), suggesting a good hard template effect of SiO~2~. Both BET surface area and pore volume for all CMs increased greatly after incorporation of SiO~2~ templates in the synthesis (table S4). For example, the BET surface area of CM-BTH/Co/SiO~2~ reaches 1202 m^2^ g^−1^, nearly six times that of CM-BTH/Co. The pore volume of CM-*x*/Co/SiO~2~ is as high as 2.16 cm^3^ g^−1^, also much larger than that of CM-*x*/Co. Besides SiO~2~ templates, other hard templates, such as SBA-15, were also applicable to preparation of high--surface area CMs due to the versatility of the synthetic strategy (fig. S5 and note S2).

Accidentally, it was found that the SiO~2~ templates could improve the carbon yields of SOMs (table S4). Taking Pah for example, the oven carbon yield increased greatly from 11.70 to 67.13% after incorporating SiO~2~ templates in the synthesis. Note that the carbonization of SOMs/SiO~2~ mixture without TMSs did not yield any CMs, further confirming the key role of TMSs in the CM synthesis. It is believed that the SiO~2~ templates could prevent the metal species from aggregating into big nanoparticles during the thermal decomposition of SOMs; the better dispersed metal species were more effective at catalyzing the polymerization and carbonization of SOMs. Besides, the confined effect of SiO~2~, which was found by Wang and Dai ([@R22]) in the carbonization of ionic liquids, is considered another factor in the increase of carbon yield.

We then conducted x-ray diffraction (XRD) to analyze the composition of CMs ([Fig. 4C](#F4){ref-type="fig"}). For the typical CMs, a peak centered at 26.2° that was assigned to the (002) planes of graphitic carbon and three peaks at 44.2°, 51.5°, and 75.8° that were assigned to the (111), (200), and (220) planes of metallic Co (JCPDS 15-0806) were observed in their XRD patterns ([Fig. 4C](#F4){ref-type="fig"}). After the incorporation of SiO~2~ for the CM-BPym/Co and CM-BBpy/Co precursors, the prepared CMs were free of any metallic phase, which indicated that the SiO~2~ templates were beneficial for the formation of removable Co species during the thermal decomposition of these SOMs with Co(NO~3~)~2~. TGA analyses verified that the Co contents of most SiO~2~-templating CMs (except CM-DCD/Co/SiO~2~, CM-Mel/Co/SiO~2~, and CM-DBrBPy/Co/SiO~2~) were much lower than those of CMs prepared without SiO~2~ templates (tables S1 and S4). We also collected Raman spectra of the samples to further assess the graphitic structure of the CMs ([Fig. 4D](#F4){ref-type="fig"}). We observed a typical D band (1350 cm^−1^) resulting from the disordered carbon atoms and a G band (1590 cm^−1^) from sp^2^-hybridized graphitic carbon atoms for all of the investigated samples. The *I*~D~/*I*~G~ values of the investigated CMs are about 1, indicating the high graphitic degree of these CMs ([@R36]). We found that heteroatom-free Pah-derived CM (that is, CM-Pah/Co) had a lower *I*~D~/*I*~G~ (0.947) than the CMs derived from heteroatom-containing SOM precursors, such as CM-DCD/Co (0.998), CM-*o*PD/Co (0.978), CM-BTH/Co (0.969), and CM-Phen/Co (1.025), revealing more defects in these CMs derived from heteroatom-containing SOMs. Moreover, except CM-BTH/Co, the *I*~D~/*I*~G~ values of the investigated CM-*x*/Co are more than that of the corresponding CM-*x*/Co/SiO~2~, suggesting that the introduction of SiO~2~ templates could improve the graphitic degree of CMs. The results can also be explained by the fact that SiO~2~ templates could make Co species be better dispersed during the thermal decomposition of SOMs, resulting in more effective graphitization of SOMs at high temperature.

We further probed the chemical compositions and element bonding configurations of the CMs by x-ray photoelectron spectroscopy (XPS) measurements. Tables S1 and S4 summarize the types and contents of various elements in CMs based on the XPS analyses. [Figure 4E](#F4){ref-type="fig"} shows the survey spectra of two typical CMs (that is, CM-DCD/Co and CM-BTh/Co). Most CMs consist of C, O, N, and Co elements. The N element in CMs that we prepared with N-free SOMs (that is, BP, *o*DHB, BTh, DBrBTh, and Pah) originated from nitrate ion in Co(NO~3~)~2~. The N contents of the CMs ranged from 0.31 to 6.44%, depending on the molecular precursors. Moreover, considerable S doping was achieved for the CMs prepared from BTh (13.35% S for CM-BTH/Co) and DBrBTh (11.73% S for CM-DBrBTH/Co). We analyzed the high-resolution N 1s and Co 2p spectra of CM-DCD/Co to reveal the N and Co chemical environments ([Fig. 4F](#F4){ref-type="fig"}). The N 1s spectra could be deconvoluted into four peaks assignable to the pyridinic N (398.9 eV), pyrrolic N (399.9 eV), graphitic N (401.2 eV), and oxidized N (403.1 eV) ([@R31], [@R32], [@R37]), indicating that N was structurally integrated into the carbon matrix. The high-resolution Co 2p~3/2~ spectrum of CM-DCD/Co consisted of two peaks at the binding energies of 781.8 and 779.8 eV, which correspond to nitrogen- and oxygen-coordinated Co, respectively ([@R32]). In addition, scanning TEM--energy dispersive spectroscopic (STEM-EDS) elemental mapping revealed the homogeneous distribution of N and/or S over the whole carbon matrix in CMs (figs. S6 to S8). Note that the Co element was also uniformly distributed on carbon framework for the Co particle--free samples (for example, CM-*o*PD/Co/SiO~2~). Previous researches have revealed that the heteroatom doping in CMs could effectively modify their electronic characteristics, spin structures, and surface chemical properties, which frequently resulted in enhanced performances in electrocatalysis, supercapacitors, lithium-ion batteries, etc. ([@R1], [@R9]). In particular, the nitrogen-metal coordinated structures in CMs were believed to be highly active in various electrocatalysis and heterogeneous processes ([@R10]--[@R12], [@R38]--[@R40]).

Overall, as stated above, the versatility of the synthetic strategy allowed us to produce distinct CMs in terms of yield, surface chemical functionality (that is, N, O, S, and metal doping), porosity, and graphitic structure. Although it is impossible to figure out a detailed carbonization process of SOMs/TMSs, which may differ substantially depending on the molecular structures of SOMs and the type of TMSs, we would conclude that TMSs played a key role for the synthesis of CMs in two aspects. First, TMSs greatly improved the thermal stability of SOMs by donating electrons from heteroatoms in SOMs (for example, *o*PD, *o*DHB, BPy, BPym, BTh, etc.) to the vacant d orbitals in transition metal ions. This made the SOMs survive harsh carbonization conditions, at which the SOMs were thermally polymerized and cross-linked into polymeric intermediates that finally formed CMs at high temperature. Second, transition metals could catalyze the polymerization of the SOMs by dehalogenation C--C coupling (for example, DBrBPy and DBrBTh) ([@R26], [@R29]), dehydrogenation C--C coupling (for example, BPy, BTh, Phen, etc.) ([@R30]), or cross-linking of --NH~2~ and --CN functional groups (for example, *o*PD, DCD, and Mel) at a relatively low temperature ([@R21], [@R23]), which therefore eventually avoided the sublimation of the SOMs and resulted in CMs. XPS analyses of DBrPhen/Co(NO~3~)~2~ system reveal that the atom ratios of Br/C gradually decrease with the increase of carbonization temperatures, from 16.24% for the DBrPhen/Co(NO~3~)~2~ precursor to 2.50% for the carbonized product at 500°C (fig. S9), indicating the removal of bromine groups and the possible occurrence of dehalogenation C--C coupling to form the conjugated polymer, as demonstrated by numerous studies in solution or on metal surface ([@R29]). We detected high--molecular weight organic species by gel permeation chromatography in the soluble part of the carbonization product that was obtained by heating DBrPhen with Co(NO~3~)~2~ at 250°C for 0.5 hours under N~2~ (fig. S10). When the pyroysis temperature increased to 400°C, the carbonized products could not be soluble in various solvents anymore (fig. S11), revealing the formation of highly cross-linked polymers at an elevated temperature. Furthermore, we tried to get soluble components from the products after pyrolysis of DBrBTH/Co(NO~3~)~2~ at a relatively low temperature of 200°C and analyzed them by ultraviolet-visible (UV-vis) absorption spectroscopy (fig. S12). The DBrBTh molecule shows a maximum absorption at ca. 320 nm, while the maximum absorption of DBrBTh/Co-200 generates bathochromic shift to ca. 395 nm, indicating the formation of thiophene oligomers with a bigger conjugated system ([@R41], [@R42]).

Note that we failed to get CMs from low--boiling point SOMs that are liquids at room temperature (fig. S13). One possible reason was that these SOMs in the mixtures were not thermally stable enough to endure high temperature for the occurrence of polymerization before they escaped out in the form of volatile vapors.

Application of CMs in heterogeneous catalysis
---------------------------------------------

Catalytic oxidization and hydrogenation reactions represent important industrial processes that can produce key feedstocks for the synthesis of many fine chemicals ([@R43]--[@R45]). Therefore, development of low-cost, efficient, and recyclable catalysts for these reactions is highly desired but challenging. Recent research has revealed that heteroatom-doped, nanostructured CMs were promising heterogeneous catalysts for various catalytic reactions ([@R39], [@R40], [@R45], [@R46]). Four typical CMs, including CM-Phen/Co, CM-Phen/Co/SiO~2~, CM-DBrPhen/Co, and CM-DBrPhen/Co/SiO~2~, were chosen as the catalysts for heterogeneous catalysis reactions (see figs. S14 to S16 and note S3 for the detailed characterizations of these catalysts).

We first studied selective oxidization of ethylbenzene to acetophenone as the probe reaction to demonstrate the potential of our CMs as heterogeneous catalysts ([Fig. 5A](#F5){ref-type="fig"}). As shown in [Fig. 5B](#F5){ref-type="fig"}, the CM-Phen/Co exhibited a conversion of 52.4% and a good selectivity of 97.7% toward acetophenone, while a much lower conversion of 8.1% and a poor selectivity of 27.4% were achieved in the blank experiments. The highly porous CM-Phen/Co/SiO~2~ displayed the highest conversion of 91.4% and a good selectivity of 97.9%. Aberration-corrected high-angle annular dark-field STEM (HAADF-STEM) and thiocyanate ion poisoning experiments identified the atomically dispersed cobalt as the main active sites (figs. S15, F and G, and S17 and note S3). The high BET surface area of CM-Phen/Co/SiO~2~ is beneficial to the exposure of more single-atom cobalt active sites for substrate adsorption and conversion, leading to good catalytic performance. We could easily separate the CM-Phen/Co/SiO~2~ from the reaction system and use it at least five times without obvious performance degradation in terms of both activity and selectivity ([Fig. 5C](#F5){ref-type="fig"}). When we used O~2~ as the oxidant for this catalytic reaction, CM-Phen/Co/SiO~2~ also exhibited an outstanding selectivity of 99.1%, although the activity needs to be improved (fig. S18, A and B).

![Catalytic performance of CMs for selective oxidization of ethylbenzene and hydrogenation of nitrobenzene.\
(**A**) Reaction equation of selective oxidization of ethylbenzene. TBHP, tert-butyl hydroperoxide. (**B** and **C**) Activity (B) and stability (C) tests of CM catalysts for ethylbenzene oxidization. (**D**) Reaction equation of hydrogenation of nitrobenzene. (**E** and **F**) Activity (E) and stability (F) tests of CM catalysts for nitrobenzene hydrogenation.](aat0788-F5){#F5}

We then studied the hydrogenation of nitrobenzene to aniline to evaluate the catalytic performance of CMs for hydrogenation reactions ([Fig. 5D](#F5){ref-type="fig"}). We observed a negligible conversion of 4.71% for the blank experiment, while the CM-DBrPhen/Co achieved 66.3% conversion after 6 hours of reaction. Similarly, the SiO~2~-templating CMs (that is, CM-DBrPhen/Co/SiO~2~) with higher BET surface area and abundant single-atom cobalt active sites exhibited an impressive conversion of 99.0% under the same experimental conditions, which can compete with reported carbon-based heterogeneous catalysts ([@R44], [@R47]). Moreover, only a slight activity decrease was observed after five runs of catalytic reactions, probably due to the unavoidable catalyst loss during the recycle process. Moreover, the CM-DBrPhen/Co also displayed a superior catalysis performance of ca. 100.0% conversion when using H~2~ as the reductant (fig. S18, C and D). These preliminary results undoubtedly demonstrate the great application potential of the CMs for catalytic oxidization and hydrogenation reactions, while the catalytic performance could be further improved in the future by optimizing the catalyst preparation.

Application of CMs in electrocatalysis
--------------------------------------

Electrochemical processes, such as HER and ORR, play an important role in future clean energy devices ([@R48], [@R49]). Although Pt and its alloys represent the most efficient electrocatalysts for HER and ORR, their scarcity and high cost hinder their large-scale commercial applications ([@R49]). Recently, metal-nitrogen--doped CMs (M-N~*x*~/C, M = Fe, Co, Ni) have been proven to be promising non-noble metal catalysts for various electrochemical reactions ([@R11], [@R12], [@R49]). Considering the structural feature of CMs, that is, high surface area and porosity, graphitization degree, and considerable nitrogen/metal doping, we investigated the performance of the prepared CMs for catalyzing HER and ORR. For comparison, we also tested commercial 20 wt % Pt/C (Johnson Matthey) under the same conditions. As expected, the Pt/C catalyst exhibited excellent catalytic activity for HER in acidic medium with an onset potential of ca. 0 V (the potential at which the cathodic current density is 1 mA cm^−2^; [Fig. 6A](#F6){ref-type="fig"}). Meanwhile, the CM-DBrPhen/Co/SiO~2~ catalyst also displayed a low onset overpotential of only 47 mV ([Fig. 6A](#F6){ref-type="fig"}). To reach a current density of 10 mA cm^−2^, the CM-DBrPhen/Co/SiO~2~ needed an overpotential of 158 mV, which is comparable to that of reported highly active non-noble metal HER catalysts (table S5), such as Cu~3~P nanowire arrays (143 mV) ([@R50]), graphitic C~3~N~4~ nanoribbon/graphene hybrid (207 mV) ([@R51]), Co~0.6~Mo~1.4~N~2~ (200 mV) ([@R52]), and CoS~2~/reduced graphene oxide/CNT (142 mV) ([@R53]). Besides, thiocyanate ion poisoning experiments reveal that the single-atom cobalt active sites in CM-DBrPhen/Co/SiO~2~ are also the main active sites for HER (fig. S19). The Tafel slope value of the CM-DBrPhen/Co/SiO~2~ catalyst was 104.9 mV dec^−1^, falling within the range of 40 to 120 mV dec^−1^ (fig. S20A), suggesting that the HER taking place on the C-MDBrPhen/Co/SiO~2~ catalyst followed a Volmer-Heyrovsky mechanism and that the electrochemical desorption was the rate-limiting step ([@R12], [@R54]).

![Electrocatalytic performance of CMs for HER.\
(**A** and **B**) Polarization curves of CM-DBrPhen/Co/SiO~2~ and commercial Pt/C catalyst in 0.5 M H~2~SO~4~ (A) and 1 M KOH (B). (**C**) Chronopotentiometry tests of CM-DBrPhen/Co/SiO~2~ at 10 mA cm^−2^ in 0.5 M H~2~SO~4~ and 1 M KOH, respectively.](aat0788-F6){#F6}

Furthermore, we also studied the electrocatalytic HER activity of CM-DBrPhen/Co/SiO~2~ in basic media (1 M KOH). The polarization curve of CM-DBrPhen/Co/SiO~2~ showed a small overpotential of 271 mV for achieving a significant hydrogen evolution at the current density of 10 mA cm^−2^ ([Fig. 6B](#F6){ref-type="fig"}). The CM-DBrPhen/Co/SiO~2~ electrocatalyst outperformed the Pt/C catalyst for overpotential higher than ca. 400 mV, making the CM-DBrPhen/Co/SiO~2~ catalyst an excellent nonprecious metal HER electrocatalyst in alkaline media ([@R54]). In addition, the CM-DBrPhen/Co/SiO~2~ catalyst exhibited a notably small Tafel slope of 78.8 mV dec^−1^ (fig. S20B), even less than that of Pt/C (83.0 mV dec^−1^), indicating a favorable kinetics for CM-DBrPhen/Co/SiO~2~. We finally used a chronopotentiometry method to evaluate the stability of CM-DBrPhen/Co/SiO~2~ for HER. Twelve hours of continuous tests at 10 mA cm^−2^ did not cause any noticeable increase of overpotential in both acidic and basic media ([Fig. 6C](#F6){ref-type="fig"}), indicating the excellent durability of CM-DBrPhen/Co/SiO~2~ catalyst for HER. Besides catalyzing HER, the obtained CM was also highly efficient in catalyzing ORR in acidic medium (fig. S21 and note S4).

DISCUSSION
==========

To summarize, we report a facile, effective, and scalable approach for the synthesis of CMs by a transition metal--assisted thermal transformation of a variety of SOMs. In particular, the methodology allows effective control of the surface chemical functionality (that is, heteroatom and metal doping), porosity, and morphology of CMs at the molecular level for various applications. The prepared heteroatom/metal-doped CMs with high surface area and graphitic structure exhibited promising performance for catalytic selective oxidization of ethylbenzene and hydrogenation of nitrobenzene, as well as eletrocatalytic HER and ORR. There is still a large room for the further improvement of the catalytic performance by the exploration of numerous molecular precursors and transition metals. Moreover, dual heteroatom--doped (for example, N/S) and bimetallic (for example, Co/Cu) CM catalysts that we can easily obtain with our approach would also potentially lead to an enhancement in the catalytic activity for various reactions (fig. S22). The transition metal--assisted thermal transformation of molecular precursor into CMs described in the present work sheds new light on the future development of functional carbon-based materials with promising applications in heterogeneous catalysis, electrocatalysis, and supercapacitors. Future work will be dedicated to better understanding the thermal decomposition mechanism of various SOMs and figure out a clear correlation between molecules, carbon structures, and performances.

MATERIALS AND METHODS
=====================

Materials
=========

SiO~2~ fumed powder and SBA-15 were purchased from Sigma-Aldrich and ShangHai JiangGe Chem Co. Ltd., respectively. Other chemicals were commercially available from Sinopharm Chemical Reagent Co. Ltd. and used as received without further purification.

Synthesis of CMs
----------------

In a typical synthesis, 0.5 g of SOMs and 0.25 g of Co(NO~3~)~2~·6H~2~O (W~Co~/W~SOM~ is 1/10) were first dissolved in suitable solvents, including deionized water (for dissolving DCD, 4-MI, and Mel), ethanol (for dissolving *o*PD, BP, *o*DHB, Phen, and DBrPhen), *N*,*N*′-dimethylformamide (DMF) (for dissolving BPy, DBrBPy, BPym, Pah, and BBPy), and tetrahydrofuran (for dissolving BTh and DBrBTh). The solvent was then removed by rotary evaporation. The obtained dried powder was subsequently carbonized under flowing N~2~ for 2 hours at 900°C. Finally, the carbonized product was leached in 0.5 M H~2~SO~4~ at 90°C for 4 hours to remove unstable metallic species and afford CMs. For the typical templating synthesis, 0.5 g of SiO~2~ fumed powder (7 nm; Sigma-Aldrich S5130) or 0.5 g of SBA-15 (ShangHai JiangGe Chem Co. Ltd.) was added into the solution dissolved with SOMs and Co(NO~3~)~2~·6H~2~O. After drying and carbonization of the mixture under the same conditions, the product then underwent alkaline (2.0 M NaOH) and acidic (0.5 M H~2~SO~4~) leaching successively to remove SiO~2~ templates and unstable metallic species, respectively.

Instrumentation
---------------

SEM images were obtained on a Zeiss Supra 40 scanning electron microscope at an acceleration voltage of 5 kV. TEM was carried out using a Hitachi H7650 or Hitachi H7700 transmission electron microscope with a charge-coupled device imaging system and an accelerating voltage of 100 kV. XRD data were recorded on a Philips X'Pert PRO SUPER X-ray diffractometer equipped with graphite monochromatic Cu Kα radiation (λ = 1.54056 Å). XPS were acquired on an x-ray photoelectron spectrometer (ESCALAB MKII) with an excitation source of Mg Kα radiation (1253.6 eV). TGA was measured by a TGA Q5000IR analyzer under N~2~ or O~2~ flow with a temperature ramp of 10°C min^−1^. HRTEM was performed on JEOL-2100F with an acceleration voltage of 200 kV. STEM-EDS element mapping was carried out on a JEOL-2100F equipped with Oxford Inca.Aberration-corrected HAADF-STEM images were acquired using a JEM-ARM 200F atomic resolution analytical microscope operating at an accelerating voltage of 200 kV. Raman scattering spectra were recorded with a Renishaw System 2000 spectrometer using the 514.5-nm line of an Ar^+^ laser for excitation. N~2~ sorption analysis was conducted using an ASAP 2020 accelerated surface area and porosimetry instrument (Micromeritics), equipped with automated surface area, at 77 K using BET calculations for the surface area. The PSD plot was recorded from the adsorption branch of the isotherm based on the Barrett-Joyner-Halenda model. Gel permeation chromatography (GPC) measurements were conducted by using a multiangle laser light scattering (MALLS) detector. DMF containing LiBr (10 mM) was used as the eluent at a flow rate of 1.0 ml min^−1^. The Wyatt MALLS detector (120 mW solid-state laser; λ = 658 nm; DawnHeleos S/N342-H) measures the excess Rayleigh ratios (related to the scattered light intensity) at different angles for each slice of the chromatogram. Raw data were processed with the Astra V software (Wyatt Technology). The UV-vis absorption spectra were recorded on a PerkinElmer Lambda 950 spectrophotometer.

Catalytic oxidation of ethylbenzene
-----------------------------------

In a typical catalytic experiment, 61 μl of ethylbenzene (0.5 mmol), 1100 μl of tert-butyl hydroperoxide (70 wt % water), and 5.0 mg of CM catalyst were added in a glass reaction tube sealed with a Teflon lid. Then, the mixture was heated under stirring at the 80°C for 6 hours. Afterward, 77 μl of anisole was added into the reaction system and used as an internal standard. Ten milliliters of ethyl acetate was used to extract the organic compounds in the reaction system. Finally, the reaction products were analyzed using a Shimadzu gas chromatograph with a flame ionization detector and high-purity nitrogen as the carrier gas. For the stability tests, the CM catalyst was recovered by centrifugation under 9000 rpm for 9 min, thoroughly washed with ethanol and water, and dried under vacuum at 60°C overnight.

The oxidation of ethylbenzene using O~2~ as the oxidant was carried out in a steel Parr autoclave. Typically, 1 ml of substrate and 10 mg of CM catalyst were added into the reaction glass vial, and the reaction vial was placed into a Parr autoclave reactor. Then, the autoclave was sealed and purged with O~2~ to replace the air three times to reach 1 MPa. Subsequently, the reactor was heated to 120°C in 20 min. The reaction was carried out for 10 hours with magnetic stirring (stirring rate, 1500 rpm). After the reaction, the reactor was placed in ice water to quench the reaction, and the products were analyzed by glassy carbon (GC) with the same method as above.

Catalytic hydrogenation of nitrobenzene
---------------------------------------

In a typical experiment, 102 μl of nitrobenzene (1 mmol), 200 μl of hydrazine hydrate (4 mmol), 5 mg of CM catalyst, and 5 ml of ethanol were introduced into 25-ml round flasks. The reaction was refluxed at 85°C for 6 hours with magnetic stirring at 1000 rpm. After cooling at room temperature, 46 μl of *n*-dodecane was then added in the reaction system as an internal standard. Ten milliliters of ethyl acetate was used to extract the organic compounds in the reaction system. For the stability tests, the catalyst was separated by centrifugation, washed with ethanol and water several times, and then dried under vacuum at 60°C overnight.

The hydrogenation of nitrobenzene using H~2~ as the reductant was carried out in a steel Parr autoclave. Typically, 102 μl of substrate (1 mmol), 2 ml of tetrahydrofuran, 100 μl of H~2~O, and 10 mg of CM catalyst were added into a reaction glass vial, and the reaction vial was placed into a Parr autoclave reactor. Then, the autoclave was sealed and purged with H~2~ to replace the air three times to reach 4.9 MPa. Subsequently, the reactor was heated to 110°C. The reaction was carried out for 10 hours with magnetic stirring (stirring rate, 1500 rpm). After reaction, the reactor was placed in ice water to quench the reaction, and the products were analyzed by GC with the same method as above.

Electrocatalytic HER measurements
---------------------------------

All electrochemical measurements were performed in a conventional three-electrode cell using a WaveDriver 20 bipotentiostat (Pine Instrument Company) controlled at room temperature. Ag/AgCl (3.5 M KCl) and platinum foil were used as reference and counter electrodes, respectively. For HER stability test, a graphite rod was used as the counter electrode to avoid the possible contribution of dissolved Pt species. All potentials in this study refer to reversible hydrogen electrode (RHE). The potential difference between Ag/AgCl and RHE was determined on the basis of the calibration measurement in H~2~-saturated electrolyte. A 5.0-mm-diameter GC disk (disk geometric area, 0.196 cm^2^) was used as the substrate of working electrode, with a thorough clean and a mirror-finished polish before use. To prepare the working electrode for electrochemical measurements, the catalyst inks were prepared by blending 10 mg of each catalyst with 100 μl of Nafion solution (0.5 wt %) and 920 μl of ethanol. Then, the inks were ultrasonicated to generate a homogeneous dispersion. Twelve microliters of the dispersion was pipetted onto the GC disk and dried at room temperature, resulting in the catalyst loading of 0.6 mg cm^−2^. For comparison, the working electrode of commercial 20 wt % Pt/C was obtained as follows: 5 mg of Pt/C and 25 μl of Nafion solution (0.5 wt %) were added in 5 ml of isopropanol by sonication for 0.5 hours to obtain a well-dispersed ink. Twelve microliters of ink was then pipetted on the GC surface, leading to a loading of 0.06 mg cm^−2^. The electrocatalytic HER measurements were performed in N~2~-saturated 0.5 M H~2~SO~4~ or 1 M KOH solution. Linear sweep voltammetry was measured at 1600 rpm \[to remove the in situ--formed H~2~ bubbles on the rotating disk electrode (RDE)\] with a sweep rate of 2 mV s^−1^. To test the durability of catalysts, a 12-hour chronopotentiometry test was conducted at 10 mA cm^−2^.

Electrocatalytic ORR measurements
---------------------------------

For ORR tests of CM catalyst, 0.5 M H~2~SO~4~ was saturated with N~2~/O~2~ by bubbling N~2~/O~2~ before the start of each experiment for 30 min. The cyclic voltammetry tests were performed in N~2~- and O~2~-saturated 0.5 M H~2~SO~4~ electrolyte solutions with a scan rate of 50 mV s^−1^. RDE tests were measured in O~2~-saturated 0.5 M H~2~SO~4~ at 1600 rpm with a sweep rate of 10 mV s^−1^. Pt/C catalyst was also measured under the same conditions, except that 0.1 M HClO~4~ solution was used to avoid performance loss caused by bisulfate adsorption. The ORR durability was evaluated by accelerated durability tests at 50 mV s^−1^ under oxygen atmosphere for 2000 cycles.

Supplementary Material
======================

###### http://advances.sciencemag.org/cgi/content/full/4/7/eaat0788/DC1

We thank J.-M. Hu for the assistance in the GPC test and Y.-Z. Tan for the helpful discussions in characterizing polymeric intermediates. **Funding:** S.-H.Y. acknowledges the funding support from the National Natural Science Foundation of China (grants 21431006 and 21761132008), the Foundation for Innovative Research Groups of the National Natural Science Foundation of China (grant 21521001), Key Research Program of Frontier Sciences, Chinese Academy of Sciences (CAS) (grant QYZDJ-SSW-SLH036), the National Basic Research Program of China (grant 2014CB931800), and the Users with Excellence and Scientific Research Grant of Hefei Science Center of CAS (2015HSC-UE007). H.-W.L. is thankful for the support by "the Recruitment Program of Global Experts" and the National Natural Science Foundation of China (grant 21671184). Z.-Y.W. acknowledges the funding support from the National Postdoctoral Program for Innovative Talents (grant BX201600142), the China Postdoctoral Science Foundation (grant 2017M610383), the Fundamental Research Funds for the Central Universities (grant WK2060190077), and the National Natural Science Foundation of China (grant 21703229). **Author contributions:** S.-H.Y., H.-W.L., and Z.-Y.W. conceived and designed the experiments. Z.-Y.W., S.-L.X., Q.-Q.Y., and Z.-Q.C. conducted the synthesis of the CMs. S.-L.X., Y.-W.D., and C.L. performed the characterization of CMs. S.-L.X. performed the catalytic experiments. S.-H.Y., H.-W.L., Z.-Y.W., and S.-L.X. co-wrote the manuscript. All authors discussed the results and commented on the manuscript. **Competing interests:** The authors declare that they have no competing interests. **Data and materials availability:** All data needed to evaluate the conclusions in the paper are present in the paper and/or the Supplementary Materials. Additional data related to this paper may be requested from the authors.

Supplementary material for this article is available at <http://advances.sciencemag.org/cgi/content/full/4/7/eaat0788/DC1>

Fig. S1. TGA analyses.

Fig. S2. SEM and TEM images of CM-*x*/Co samples.

Fig. S3. TEM images of *o*PD-derived CMs prepared with different TMSs.

Fig. S4. SEM and TEM images of SiO~2~-templating CMs.

Fig. S5. Characterizations of CM-*o*PD/Co/SBA-15, and CM-Phen/Co/SBA-15.

Fig. S6. STEM-EDS elemental mapping images of CM-DCD/Co and CM-DCD/Co/SiO~2~.

Fig. S7. STEM-EDS elemental mapping images of CM-*o*PD/Co and CM-*o*PD/Co/SiO~2~.

Fig. S8. STEM-EDS elemental mapping images of CM-BTH/Co and CM-BTH/Co/SiO~2~.

Fig. S9. XPS survey spectra of the DBrPhen/Co(NO~3~)~2~ precursor and its carbonization products obtained at 200° to 500°C.

Fig. S10. GPC result of the sample that prepared by heating DBrPhen with Co(NO~3~)~2~ at 250°C for 0.5 hours under N~2~.

Fig. S11. Images of dispersing carbonization product obtained by heating DBrPhen with Co(NO~3~)~2~ at 400°C for 2 hours under N~2~.

Fig. S12. UV-vis absorption spectra for DBrBTh and the carbonization product obtained by heating BTh/Co(NO~3~)~2~ at 200°C for 0.5 hours under N~2~.

Fig. S13. The structures of four SOMs that could not be converted into CMs.

Fig. S14. XRD patterns of CM-Phen/Co, CM-Phen/Co/SiO~2~, CM-DBrPhen/Co, and CM-DBrPhen/Co/SiO~2~.

Fig. S15. Detailed characterizations of CM-Phen/Co and CM-Phen/Co/SiO~2~ catalysts.

Fig. S16. Detailed characterizations of CM-DBrPhen/Co and CM-DBrPhen/Co/SiO~2~ catalysts.

Fig. S17. The poisoning experiments for ethylbenzene oxidization and nitrobenzene hydrogenation.

Fig. S18. Catalytic performance for selective oxidization of ethylbenzene using O~2~ as the oxidant and hydrogenation of nitrobenzene using H~2~ as the reductant.

Fig. S19. The poisoning experiments for HER.

Fig. S20. Tafel curves of CM-DBrPhen/Co/SiO~2~ and commercial Pt/C catalyst.

Fig. S21. Electrocatalytic performance of CMs for ORR in acidic medium.

Fig. S22. HER polarization curves of CM-*o*PD/Co/SiO~2~ and CM-*o*PD/CoCu/SiO~2~ in 0.5 M H~2~SO~4~.

Table S1. Summary of carbon yield, texture properties, elemental composition of CMs prepared with Co(NO~3~)~2~ as the catalyst.

Table S2. Carbon yields of *o*PD with different TMSs as catalysts.

Table S3. Carbon yields of *o*PD with different amounts of Co(NO~3~)~2~ as catalysts.

Table S4. Summary of carbon yield, texture properties, and elemental composition of CMs prepared with Co(NO~3~)~2~ as the catalyst and SiO~2~ nanoparticles as hard templates.

Table S5. HER performance comparison.

Note S1. The proposed mechanism for different microstructures of CM-*x*/Co samples.

Note S2. Synthesis of high--surface area CMs from SOMs with SBA-15 as templates.

Note S3. Detailed characterization analysis of CM-Phen/Co, CM-Phen/Co/SiO~2~, CM-DBrPhen/Co, and CM-DBrPhen/Co/SiO~2~.

Note S4. Electrocatalytic performance of CMs for ORR.

References ([@R55]--[@R65])

[^1]: These authors contributed equally to this work.