pub fn render_document_for_copy(
document: &Document,
settings: &RenderSettings,
) -> StringExpand description
Renders a document in plain copy-safe form.
Like render_output_for_copy, this strips ANSI/rich rendering concerns so
the returned text is suitable for clipboards and paste targets.
ยงExamples
use osp_cli::core::output::{ColorMode, OutputFormat};
use osp_cli::ui::{
Block, Document, LineBlock, LinePart, RenderSettings, render_document_for_copy,
};
let document = Document {
blocks: vec![Block::Line(LineBlock {
parts: vec![LinePart {
text: "hello".to_string(),
token: None,
}],
})],
};
let settings = RenderSettings::builder()
.with_format(OutputFormat::Auto)
.with_color(ColorMode::Always)
.build();
let rendered = render_document_for_copy(&document, &settings);
assert_eq!(rendered.trim(), "hello");
assert!(!rendered.contains('\u{1b}'));