feat: Created the raw_markdown configuration flag

This commit is contained in:
2026-07-22 11:03:27 -06:00
parent 393ed16963
commit ed7ad36475
7 changed files with 33 additions and 1 deletions
+1
View File
@@ -20,6 +20,7 @@ agent_session: null # Set a session to use when starting an agent (
# ---- Appearance ---- # ---- Appearance ----
highlight: true # Controls syntax highlighting highlight: true # Controls syntax highlighting
raw_markdown: false # When true, render markdown as raw text with syntax highlighting only. When false (default), transforms markdown syntax (headings, bold, lists, etc.) into styled terminal output
light_theme: false # Activates a light color theme when true. env: COYOTE_LIGHT_THEME light_theme: false # Activates a light color theme when true. env: COYOTE_LIGHT_THEME
# ---- Miscellaneous ---- # ---- Miscellaneous ----
+3
View File
@@ -68,6 +68,9 @@ pub struct Cli {
/// Turn off stream mode /// Turn off stream mode
#[arg(short = 'S', long)] #[arg(short = 'S', long)]
pub no_stream: bool, pub no_stream: bool,
/// Render markdown as raw text with syntax highlighting only (skip the rich markdown renderer)
#[arg(long)]
pub raw_markdown: bool,
/// Display the message without sending it /// Display the message without sending it
#[arg(long)] #[arg(long)]
pub dry_run: bool, pub dry_run: bool,
+13 -1
View File
@@ -86,6 +86,7 @@ pub struct AppConfig {
pub document_loaders: HashMap<String, String>, pub document_loaders: HashMap<String, String>,
pub highlight: bool, pub highlight: bool,
pub raw_markdown: bool,
pub theme: Option<String>, pub theme: Option<String>,
pub left_prompt: Option<String>, pub left_prompt: Option<String>,
pub right_prompt: Option<String>, pub right_prompt: Option<String>,
@@ -165,6 +166,7 @@ impl Default for AppConfig {
document_loaders: Default::default(), document_loaders: Default::default(),
highlight: true, highlight: true,
raw_markdown: false,
theme: None, theme: None,
left_prompt: None, left_prompt: None,
right_prompt: None, right_prompt: None,
@@ -246,6 +248,7 @@ impl AppConfig {
document_loaders: config.document_loaders, document_loaders: config.document_loaders,
highlight: config.highlight, highlight: config.highlight,
raw_markdown: config.raw_markdown,
theme: config.theme, theme: config.theme,
left_prompt: config.left_prompt, left_prompt: config.left_prompt,
right_prompt: config.right_prompt, right_prompt: config.right_prompt,
@@ -405,7 +408,13 @@ impl AppConfig {
env::var("COLORTERM").as_ref().map(|v| v.as_str()), env::var("COLORTERM").as_ref().map(|v| v.as_str()),
Ok("truecolor") Ok("truecolor")
); );
Ok(RenderOptions::new(theme, wrap, self.wrap_code, truecolor)) Ok(RenderOptions::new(
theme,
wrap,
self.wrap_code,
self.raw_markdown,
truecolor,
))
} }
pub fn print_markdown(&self, text: &str) -> Result<()> { pub fn print_markdown(&self, text: &str) -> Result<()> {
@@ -589,6 +598,9 @@ impl AppConfig {
if *NO_COLOR { if *NO_COLOR {
self.highlight = false; self.highlight = false;
} }
if let Some(Some(v)) = super::read_env_bool(&get_env_name("raw_markdown")) {
self.raw_markdown = v;
}
if self.highlight && self.theme.is_none() { if self.highlight && self.theme.is_none() {
if let Some(v) = super::read_env_value::<String>(&get_env_name("theme")) { if let Some(v) = super::read_env_value::<String>(&get_env_name("theme")) {
self.theme = v; self.theme = v;
+2
View File
@@ -262,6 +262,7 @@ pub struct Config {
pub document_loaders: HashMap<String, String>, pub document_loaders: HashMap<String, String>,
pub highlight: bool, pub highlight: bool,
pub raw_markdown: bool,
pub theme: Option<String>, pub theme: Option<String>,
pub left_prompt: Option<String>, pub left_prompt: Option<String>,
pub right_prompt: Option<String>, pub right_prompt: Option<String>,
@@ -339,6 +340,7 @@ impl Default for Config {
document_loaders: Default::default(), document_loaders: Default::default(),
highlight: true, highlight: true,
raw_markdown: false,
theme: None, theme: None,
left_prompt: None, left_prompt: None,
right_prompt: None, right_prompt: None,
+7
View File
@@ -1598,6 +1598,7 @@ impl RequestContext {
("wrap", wrap), ("wrap", wrap),
("wrap_code", app.wrap_code.to_string()), ("wrap_code", app.wrap_code.to_string()),
("highlight", app.highlight.to_string()), ("highlight", app.highlight.to_string()),
("raw_markdown", app.raw_markdown.to_string()),
("theme", super::format_option_value(&app.theme)), ("theme", super::format_option_value(&app.theme)),
("config_file", display_path(&paths::config_file())), ("config_file", display_path(&paths::config_file())),
("env_file", display_path(&paths::env_file())), ("env_file", display_path(&paths::env_file())),
@@ -2724,6 +2725,10 @@ impl RequestContext {
let value = value.parse().with_context(|| "Invalid value")?; let value = value.parse().with_context(|| "Invalid value")?;
self.update_app_config(|app| app.highlight = value); self.update_app_config(|app| app.highlight = value);
} }
"raw_markdown" => {
let value = value.parse().with_context(|| "Invalid value")?;
self.update_app_config(|app| app.raw_markdown = value);
}
"auto_continue" => { "auto_continue" => {
let value: bool = value.parse().with_context(|| "Invalid value")?; let value: bool = value.parse().with_context(|| "Invalid value")?;
if value && !self.app.config.function_calling_support { if value && !self.app.config.function_calling_support {
@@ -2928,6 +2933,7 @@ impl RequestContext {
"stream", "stream",
"save", "save",
"highlight", "highlight",
"raw_markdown",
]; ];
if !self.current_model().reasoning_levels().is_empty() { if !self.current_model().reasoning_levels().is_empty() {
values.push("reasoning_effort"); values.push("reasoning_effort");
@@ -3187,6 +3193,7 @@ impl RequestContext {
.map(|v| v.id()) .map(|v| v.id())
.collect(), .collect(),
"highlight" => super::complete_bool(app.highlight), "highlight" => super::complete_bool(app.highlight),
"raw_markdown" => super::complete_bool(app.raw_markdown),
"auto_continue" => { "auto_continue" => {
let config = self.auto_continue_config(); let config = self.auto_continue_config();
super::complete_bool(config.enabled) super::complete_bool(config.enabled)
+3
View File
@@ -367,6 +367,9 @@ async fn run(
if cli.no_stream { if cli.no_stream {
update_app_config(&mut ctx, |app| app.stream = false); update_app_config(&mut ctx, |app| app.stream = false);
} }
if cli.raw_markdown {
update_app_config(&mut ctx, |app| app.raw_markdown = true);
}
if cli.no_memory { if cli.no_memory {
update_app_config(&mut ctx, |app| app.memory = Some(false)); update_app_config(&mut ctx, |app| app.memory = Some(false));
} }
+4
View File
@@ -202,6 +202,8 @@ pub struct RenderOptions {
pub theme: Option<Theme>, pub theme: Option<Theme>,
pub wrap: Option<String>, pub wrap: Option<String>,
pub wrap_code: bool, pub wrap_code: bool,
#[allow(dead_code)]
pub raw_markdown: bool,
pub truecolor: bool, pub truecolor: bool,
} }
@@ -210,12 +212,14 @@ impl RenderOptions {
theme: Option<Theme>, theme: Option<Theme>,
wrap: Option<String>, wrap: Option<String>,
wrap_code: bool, wrap_code: bool,
raw_markdown: bool,
truecolor: bool, truecolor: bool,
) -> Self { ) -> Self {
Self { Self {
theme, theme,
wrap, wrap,
wrap_code, wrap_code,
raw_markdown,
truecolor, truecolor,
} }
} }