MCPcopy Create free account
hub / github.com/aiprodcoder/MIXAPI / formatContent

Function formatContent

web/src/components/playground/CodeViewer.js:97–118  ·  view source on GitHub ↗
(content)

Source from the content-addressed store, hash-verified

95};
96
97const formatContent = (content) => {
98 if (!content) return '';
99
100 if (typeof content === 'object') {
101 try {
102 return JSON.stringify(content, null, 2);
103 } catch (e) {
104 return String(content);
105 }
106 }
107
108 if (typeof content === 'string') {
109 try {
110 const parsed = JSON.parse(content);
111 return JSON.stringify(parsed, null, 2);
112 } catch (e) {
113 return content;
114 }
115 }
116
117 return String(content);
118};
119
120const CodeViewer = ({ content, title, language = 'json' }) => {
121 const { t } = useTranslation();

Callers 1

CodeViewer.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected