MCPcopy
hub / github.com/zxlie/FeHelper / beauty

Function beauty

apps/code-beautify/content-script.js:232–247  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

230 let format = (fileType, source, callback) => {
231
232 let beauty = txtResult => {
233 let code = document.getElementsByTagName('pre')[0];
234 formattedCodes = txtResult;
235 document.querySelector('html').classList.add('jf-cb');
236
237 let highlightedHtml;
238 try {
239 highlightedHtml = fileType === 'javascript' ? highlightJS(txtResult) : highlightCSS(txtResult);
240 } catch (e) {
241 highlightedHtml = esc(txtResult);
242 }
243
244 let lines = highlightedHtml.split('\n');
245 code.innerHTML = '<ol>' + lines.map(l => '<li><span>' + l + '</span></li>').join('') + '</ol>';
246 callback && callback('ok');
247 };
248
249 try {
250 if (fileType === 'javascript') {

Callers 1

formatFunction · 0.70

Calls 4

highlightJSFunction · 0.85
highlightCSSFunction · 0.85
escFunction · 0.85
addMethod · 0.45

Tested by

no test coverage detected