I am using vscode. My current extension is prettier, and my files are JavascriptReact (JSX). When I manually choose to format the code or activate format on saving, it takes content like this:
<p>
This type of cancer is also called
<Definition
term="upper tract urothelial cancer"
id="upper_tract_urothelial_cancer"
/>
(UTUC). Get to know more about the urinary tract, your cancer, and the
different types of treatment options available. And be sure to talk to your
doctor about what's right for you.
</p>
;
and turns it into this:
<p>
This type of cancer is also called{" "}
<Definition
term="upper tract urothelial cancer"
id="upper_tract_urothelial_cancer"
/>{" "} (UTUC). Get to know more about the urinary tract, your cancer, and the
different types of treatment options available. And be sure to talk to your
doctor about what's right for you.
</p>
The problem with this is that the spaces around the definition component should be taken as literal spaces (i.e.
) or {' '}
). But the prettier formatting strips that spacing, so my <Definition/>
component, which wraps its children in a special span tag with some tooltip functionality, no longer has spacing around it, so the words all look run together (e.g. This type of cancer is also called upper tract urothelial cancer(UTUC)
).
How do I keep the formatter from messing with these lines?