ff49b986d5
- Added language-specific code formatters for JavaScript, Julia, Python, and Ruby to improve display rendering. - Integrated display formatting into browser run and eval render tools while preserving verbatim execution. - Added comprehensive test suites verifying formatting stability, lexical safety, and streaming behavior.
25 lines
809 B
TypeScript
25 lines
809 B
TypeScript
import type { EvalLanguage } from "../../eval/types";
|
|
import { formatJavaScriptForDisplay } from "./javascript";
|
|
import { formatJuliaForDisplay } from "./julia";
|
|
import { formatPythonForDisplay } from "./python";
|
|
import { formatRubyForDisplay } from "./ruby";
|
|
|
|
export * from "./javascript";
|
|
export * from "./julia";
|
|
export * from "./python";
|
|
export * from "./ruby";
|
|
|
|
/** Formats an arbitrary eval-code prefix for display without changing the executed source. */
|
|
export function formatEvalCodeForDisplay(source: string, language: EvalLanguage): string {
|
|
switch (language) {
|
|
case "js":
|
|
return formatJavaScriptForDisplay(source);
|
|
case "ruby":
|
|
return formatRubyForDisplay(source);
|
|
case "julia":
|
|
return formatJuliaForDisplay(source);
|
|
case "python":
|
|
return formatPythonForDisplay(source);
|
|
}
|
|
}
|