feat(render): add comfy-table dependency and table border style

This commit is contained in:
2026-07-22 12:11:04 -06:00
parent b0eeba110d
commit fcc4a1d2b5
3 changed files with 55 additions and 0 deletions
Generated
+40
View File
@@ -80,6 +80,15 @@ dependencies = [
"rayon", "rayon",
] ]
[[package]]
name = "ansi-str"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "060de1453b69f46304b28274f382132f4e72c55637cf362920926a70d090890d"
dependencies = [
"ansitok",
]
[[package]] [[package]]
name = "ansi_colours" name = "ansi_colours"
version = "1.2.3" version = "1.2.3"
@@ -89,6 +98,16 @@ dependencies = [
"rgb", "rgb",
] ]
[[package]]
name = "ansitok"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0a8acea8c2f1c60f0a92a8cd26bf96ca97db56f10bbcab238bbe0cceba659ee"
dependencies = [
"nom 7.1.3",
"vte",
]
[[package]] [[package]]
name = "anstream" name = "anstream"
version = "1.0.0" version = "1.0.0"
@@ -219,6 +238,12 @@ dependencies = [
"password-hash", "password-hash",
] ]
[[package]]
name = "arrayvec"
version = "0.7.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3fb67a6e08acf24fdeccbac2cb6ac4305825bd1f117462e0e6f2f193345ad56"
[[package]] [[package]]
name = "async-compression" name = "async-compression"
version = "0.4.42" version = "0.4.42"
@@ -1287,6 +1312,19 @@ dependencies = [
"memchr", "memchr",
] ]
[[package]]
name = "comfy-table"
version = "7.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "958c5d6ecf1f214b4c2bbbbf6ab9523a864bd136dcf71a7e8904799acfe1ad47"
dependencies = [
"ansi-str",
"console",
"crossterm",
"unicode-segmentation",
"unicode-width",
]
[[package]] [[package]]
name = "compression-codecs" name = "compression-codecs"
version = "0.4.38" version = "0.4.38"
@@ -1435,6 +1473,7 @@ dependencies = [
"clap_complete", "clap_complete",
"clap_complete_nushell", "clap_complete_nushell",
"colored", "colored",
"comfy-table",
"crossterm", "crossterm",
"dirs", "dirs",
"duct", "duct",
@@ -6657,6 +6696,7 @@ version = "0.14.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "231fdcd7ef3037e8330d8e17e61011a2c244126acc0a982f4040ac3f9f0bc077" checksum = "231fdcd7ef3037e8330d8e17e61011a2c244126acc0a982f4040ac3f9f0bc077"
dependencies = [ dependencies = [
"arrayvec",
"memchr", "memchr",
] ]
+1
View File
@@ -17,6 +17,7 @@ exclude = [".github", "CONTRIBUTING.md"]
anyhow = "1.0.69" anyhow = "1.0.69"
bytes = "1.4.0" bytes = "1.4.0"
clap = { version = "4.5.40", features = ["cargo", "derive", "wrap_help"] } clap = { version = "4.5.40", features = ["cargo", "derive", "wrap_help"] }
comfy-table = { version = "7.2.2", features = ["custom_styling"] }
dirs = "6.0.0" dirs = "6.0.0"
dunce = "1.0.5" dunce = "1.0.5"
futures-util = "0.3.29" futures-util = "0.3.29"
+14
View File
@@ -621,6 +621,8 @@ pub struct MarkdownStyles {
link_url: Color, link_url: Color,
strikethrough: Color, strikethrough: Color,
hrule: Color, hrule: Color,
#[allow(dead_code)]
table_border: Color,
} }
impl MarkdownStyles { impl MarkdownStyles {
@@ -671,6 +673,12 @@ impl MarkdownStyles {
let strikethrough = let strikethrough =
resolve_scope_style(theme, "markup.deleted", &["invalid"], truecolor); resolve_scope_style(theme, "markup.deleted", &["invalid"], truecolor);
let hrule = resolve_scope_style(theme, "comment", &["punctuation"], truecolor); let hrule = resolve_scope_style(theme, "comment", &["punctuation"], truecolor);
let table_border = resolve_scope_style(
theme,
"punctuation.definition.table.markdown",
&["punctuation", "meta.separator"],
truecolor,
);
Self { Self {
heading: ( heading: (
@@ -687,6 +695,7 @@ impl MarkdownStyles {
link_url: link_url.fg.unwrap_or(Color::Blue), link_url: link_url.fg.unwrap_or(Color::Blue),
strikethrough: strikethrough.fg.unwrap_or(Color::DarkGrey), strikethrough: strikethrough.fg.unwrap_or(Color::DarkGrey),
hrule: hrule.fg.unwrap_or(Color::DarkGrey), hrule: hrule.fg.unwrap_or(Color::DarkGrey),
table_border: table_border.fg.unwrap_or(Color::DarkGrey),
} }
} }
@@ -703,6 +712,7 @@ impl MarkdownStyles {
link_url: Color::Reset, link_url: Color::Reset,
strikethrough: Color::Reset, strikethrough: Color::Reset,
hrule: Color::Reset, hrule: Color::Reset,
table_border: Color::Reset,
} }
} }
} }
@@ -928,6 +938,7 @@ std::error::Error>> {
assert_eq!(styles.link_url, Color::Reset); assert_eq!(styles.link_url, Color::Reset);
assert_eq!(styles.strikethrough, Color::Reset); assert_eq!(styles.strikethrough, Color::Reset);
assert_eq!(styles.hrule, Color::Reset); assert_eq!(styles.hrule, Color::Reset);
assert_eq!(styles.table_border, Color::Reset);
} }
#[test] #[test]
@@ -945,6 +956,7 @@ std::error::Error>> {
assert_ne!(styles.link_url, Color::Reset); assert_ne!(styles.link_url, Color::Reset);
assert_ne!(styles.strikethrough, Color::Reset); assert_ne!(styles.strikethrough, Color::Reset);
assert_ne!(styles.hrule, Color::Reset); assert_ne!(styles.hrule, Color::Reset);
assert_ne!(styles.table_border, Color::Reset);
} }
#[test] #[test]
@@ -1032,6 +1044,7 @@ std::error::Error>> {
link_url: Color::Magenta, link_url: Color::Magenta,
strikethrough: Color::DarkGrey, strikethrough: Color::DarkGrey,
hrule: Color::DarkGrey, hrule: Color::DarkGrey,
table_border: Color::DarkGrey,
} }
} }
@@ -1385,5 +1398,6 @@ std::error::Error>> {
assert_eq!(styles.link_url, rgb(0x00, 0xcc, 0xff)); assert_eq!(styles.link_url, rgb(0x00, 0xcc, 0xff));
assert_eq!(styles.strikethrough, rgb(0xff, 0x00, 0x00)); assert_eq!(styles.strikethrough, rgb(0xff, 0x00, 0x00));
assert_eq!(styles.hrule, rgb(0x88, 0x88, 0x88)); assert_eq!(styles.hrule, rgb(0x88, 0x88, 0x88));
assert_eq!(styles.table_border, rgb(0x77, 0x77, 0x77));
} }
} }