omniscript-cli
Version:
OmniScript Format (OSF) CLI tools - Command-line interface for parsing, validating, and converting OSF documents
36 lines • 1.12 kB
JavaScript
;
// File: omniscript-core/cli/src/utils/markdown-utils.ts
// What: Utilities for converting OSF to Markdown format
// Why: Support Markdown export functionality
// Related: renderers/markdown.ts, text-renderer.ts
Object.defineProperty(exports, "__esModule", { value: true });
exports.textRunToMarkdown = textRunToMarkdown;
// Helper to convert TextRun to Markdown
function textRunToMarkdown(run) {
if (typeof run === 'string') {
return run;
}
if ('type' in run) {
if (run.type === 'link') {
return `[${run.text}](${run.url})`;
}
if (run.type === 'image') {
return ``;
}
}
if ('text' in run) {
let text = run.text;
const styledRun = run;
if (styledRun.bold)
text = `**${text}**`;
if (styledRun.italic)
text = `*${text}*`;
if (styledRun.underline)
text = `__${text}__`;
if (styledRun.strike)
text = `~~${text}~~`;
return text;
}
return '';
}
//# sourceMappingURL=markdown-utils.js.map