@@ -464,7 +464,7 @@ Compile a syntax tree to text.
464
464
465
465
###### Returns
466
466
467
- ` string ` — String representation of the syntax tree file.
467
+ ` string ` (see notes) — String representation of the syntax tree file.
468
468
469
469
###### Note
470
470
@@ -473,6 +473,11 @@ Compile a syntax tree to text.
473
473
` stringify ` does not apply [ transformers from the run phase] [ description ]
474
474
to the [ syntax tree] [ node ] .
475
475
476
+ Be aware that [ compiler] [ ] s typically, but not always, return strings.
477
+ Some compilers, such as [ ` rehype-react ` ] [ rehype-react ] , define other values (in
478
+ this case, a React tree).
479
+ Be aware of this, and when using TypeScript, cast the value on your side.
480
+
476
481
###### Example
477
482
478
483
The below example shows how the ` stringify ` function can be used to generate a
@@ -614,11 +619,18 @@ The process calls `parse`, `run`, and `stringify` internally.
614
619
615
620
[ ` Promise ` ] [ promise ] if ` done ` is not given.
616
621
Rejected with an error or resolved with the resulting file.
622
+ The parsed, transformed, and stringified value is exposed on ` file.contents ` .
617
623
618
624
###### Note
619
625
620
626
` process ` [ freezes] [ freeze ] the processor if not already frozen.
621
627
628
+ Be aware that [ compiler] [ ] s typically, but not always, return strings.
629
+ Some compilers, such as [ ` rehype-react ` ] [ rehype-react ] , define other values (in
630
+ this case, a React tree).
631
+ Be aware that ` file.contents ` is not always a string, and when using TypeScript,
632
+ cast the value on your side.
633
+
622
634
###### Example
623
635
624
636
The below example shows how the ` process ` function can be used to process a
@@ -1308,3 +1320,5 @@ work on [`ware`][ware], as it was a huge initial inspiration.
1308
1320
[ opensource.guide ] : https://opensource.guide
1309
1321
1310
1322
[ github ] : https://github.com
1323
+
1324
+ [ rehype-react ] : https://github.com/rhysd/rehype-react
0 commit comments