A whitespace inspection view makes invisible characters recognizable while preserving the original input. Copying and displaying can legitimately use different representations.
Worked example
// components/WhitespaceRevealView.tsx
export default function WhitespaceRevealView({
source = "Copper Studio North",
}: { source?: string } = {}) {
return (
<pre>
{source.replaceAll(" ", "·").replaceAll("\t", "→").replaceAll("\n", "↵\n")}
</pre>
);
}Implementation notes
Whitespace visualization can make two different separators look identical if the marker is too generic. Use distinguishable symbols for spaces, tabs and line ends.
Try it yourself
Inspect a tab, an ordinary space and a line break.
Open the React example →Editorial date February 8, 2026 · Published December 6, 2026