diff --git a/Cargo.lock b/Cargo.lock index bd5facf..787d088 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -449,6 +449,47 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" +[[package]] +name = "lantern-cli" +version = "0.1.0" +dependencies = [ + "clap", + "crossterm 0.29.0", + "lantern-core", + "lantern-ui", + "owo-colors", + "ratatui", + "tracing", + "tracing-subscriber", +] + +[[package]] +name = "lantern-core" +version = "0.1.0" +dependencies = [ + "crossterm 0.29.0", + "owo-colors", + "pulldown-cmark", + "serde", + "serde_json", + "serde_yml", + "syntect", + "terminal-colorsaurus", + "thiserror", + "toml", + "tracing", +] + +[[package]] +name = "lantern-ui" +version = "0.1.0" +dependencies = [ + "crossterm 0.29.0", + "lantern-core", + "owo-colors", + "ratatui", +] + [[package]] name = "lazy_static" version = "1.5.0" @@ -915,47 +956,6 @@ version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" -[[package]] -name = "slides-cli" -version = "0.1.0" -dependencies = [ - "clap", - "crossterm 0.29.0", - "owo-colors", - "ratatui", - "slides-core", - "slides-tui", - "tracing", - "tracing-subscriber", -] - -[[package]] -name = "slides-core" -version = "0.1.0" -dependencies = [ - "crossterm 0.29.0", - "owo-colors", - "pulldown-cmark", - "serde", - "serde_json", - "serde_yml", - "syntect", - "terminal-colorsaurus", - "thiserror", - "toml", - "tracing", -] - -[[package]] -name = "slides-tui" -version = "0.1.0" -dependencies = [ - "crossterm 0.29.0", - "owo-colors", - "ratatui", - "slides-core", -] - [[package]] name = "smallvec" version = "1.15.1" diff --git a/Cargo.toml b/Cargo.toml index 94abf11..0194bde 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,3 +1,38 @@ [workspace] resolver = "2" members = ["cli", "core", "ui"] + +[workspace.lints.clippy] +bool_comparison = "deny" +duplicate_mod = "deny" +inconsistent_struct_constructor = "deny" +invalid_regex = "deny" +mem_forget = "deny" +mixed_case_hex_literals = "deny" +suspicious_arithmetic_impl = "deny" +uninit_assumed_init = "deny" +suspicious_else_formatting = "deny" +suspicious_op_assign_impl = "deny" +suspicious_to_owned = "deny" +cmp_owned = "deny" +cmp_null = "deny" +manual_map = "deny" + +too_many_arguments = "warn" +cyclomatic_complexity = "warn" +large_enum_variant = "warn" +needless_borrow = "warn" +needless_pass_by_value = "warn" +redundant_clone = "warn" +unnecessary_cast = "warn" +inefficient_to_string = "warn" +or_fun_call = "warn" +unnecessary_to_owned = "warn" +map_clone = "warn" +flat_map_identity = "warn" +needless_collect = "warn" +vec_init_then_push = "warn" + +len_zero = "allow" +range_plus_one = "allow" +manual_range_contains = "allow" diff --git a/README.md b/README.md index ea38987..9af541a 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,87 @@ -# slides.rs +# lantern > A modern, fast, terminal presentation tool inspired by [`maaslalani/slides`](https://github.com/maaslalani/slides), built with Rust. +## Quickstart + +### Installation + +```bash +cargo install lantern +``` + +### Create Your First Deck + +Create a markdown file `presentation.md`: + +````markdown +--- +theme: nord +--- + +# Welcome to lantern + +A terminal presentation tool built with Rust + +--- + +## Features + +- Base16 theming system +- Syntax highlighting +- Live reload +- Export to image/video + +--- + +## Code Example + +```rust +fn main() { + println!("Hello, lantern!"); +} +``` + +--- + +## That's it + +Press `q` to quit, `←/→` to navigate + +```` + +### Present + +```bash +# Interactive TUI mode +lantern present presentation.md + +# Print to stdout +lantern print presentation.md + +# With custom theme +lantern present presentation.md --theme catppuccin-mocha +``` + +### Navigation + +| Key | Action | +| ------------ | ------------------- | +| `→`, `j`, `n` | Next slide | +| `←`, `k`, `p` | Previous slide | +| `1-9` | Jump to slide | +| `q` | Quit | + ## Design Principles __Color as Data:__ All color use flows through typed wrappers using `owo-colors`. No ad-hoc ANSI escapes. __Themeable:__ -Multiple built-in color schemes (basic, monokai, dracula, solarized, nord) with automatic light/dark variant detection based on terminal background. Themes can be selected via frontmatter, CLI flags, or environment variables, with optional explicit variant override using `:light` or `:dark` suffix. +Built on the [Base16](https://github.com/chriskempson/base16) theming system with 10 prebuilt themes (Catppuccin, Nord, Gruvbox Material, Solarized, Oxocarbon). Each theme defines 16 semantic colors mapped to content and UI elements. Themes can be selected via frontmatter, CLI flags, or environment variables. __Reproducible:__ -Everything is reproducible in plain text — decks can render without TUI (using `slides print`). +Everything is reproducible in plain text — decks can render without TUI (using `lantern print`). __Composable:__ Parser → Model → Renderer are independent modules with tests and traits. diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 2f41842..ab8609b 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "slides-cli" +name = "lantern-cli" version = "0.1.0" edition = "2024" @@ -10,5 +10,5 @@ owo-colors = "4.2.3" ratatui = "0.29.0" tracing = "0.1.41" tracing-subscriber = "0.3.20" -slides-core = { path = "../core" } -slides-tui = { path = "../ui" } +lantern-core = { path = "../core" } +lantern-ui = { path = "../ui" } diff --git a/cli/src/main.rs b/cli/src/main.rs index a9f0c11..beadb1a 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -1,7 +1,7 @@ use clap::{Parser, Subcommand}; +use lantern_core::{parser::parse_slides_with_meta, term::Terminal as SlideTerminal, theme::ThemeRegistry}; +use lantern_ui::App; use ratatui::{Terminal, backend::CrosstermBackend}; -use slides_core::{parser::parse_slides_with_meta, term::Terminal as SlideTerminal, theme::ThemeRegistry}; -use slides_tui::App; use std::{io, path::PathBuf}; use tracing::Level; @@ -158,7 +158,7 @@ fn run_print(file: &PathBuf, width: usize, theme_arg: Option) -> io::Res let theme = ThemeRegistry::get(&theme_name); - slides_core::printer::print_slides_to_stdout(&slides, &theme, width)?; + lantern_core::printer::print_slides_to_stdout(&slides, &theme, width)?; Ok(()) } diff --git a/core/Cargo.toml b/core/Cargo.toml index 1050a4c..a4b1319 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "slides-core" +name = "lantern-core" version = "0.1.0" edition = "2024" diff --git a/docs/src/appendices/themes.md b/docs/src/appendices/themes.md index b1bdca6..f1bd00a 100644 --- a/docs/src/appendices/themes.md +++ b/docs/src/appendices/themes.md @@ -1,6 +1,6 @@ # Themes -slides.rs uses the [Base16](https://github.com/chriskempson/base16) theming system for customizing the appearance of your presentations. Base16 provides a standardized way to define color schemes that work consistently across dark and light backgrounds. +lantern uses the [Base16](https://github.com/chriskempson/base16) theming system for customizing the appearance of your presentations. Base16 provides a standardized way to define color schemes that work consistently across dark and light backgrounds. ## Base16 Color System @@ -27,7 +27,7 @@ Base16 defines 16 semantic colors (base00 through base0F) that serve specific pu ## Color Mapping -slides.rs maps base16 colors to semantic roles: +lantern maps base16 colors to semantic roles: ### Content Colors @@ -51,7 +51,7 @@ slides.rs maps base16 colors to semantic roles: ## Available Themes -slides.rs includes 10 prebuilt base16 themes, embedded at compile time: +lantern includes 10 prebuilt base16 themes, embedded at compile time: ### Catppuccin @@ -109,17 +109,17 @@ theme = "nord" Override the theme with the `--theme` flag: ```bash -slides present slides.md --theme nord -slides print slides.md --theme catppuccin-latte +lantern present presentation.md --theme nord +lantern print presentation.md --theme catppuccin-latte ``` ### Via Environment Variable -Set a default theme using the `SLIDES_THEME` environment variable: +Set a default theme using the `LANTERN_THEME` environment variable: ```bash -export SLIDES_THEME=gruvbox-material-dark -slides present slides.md +export LANTERN_THEME=gruvbox-material-dark +lantern present presentation.md ``` ## Theme Priority @@ -128,7 +128,7 @@ When multiple theme sources are specified, the priority order is: 1. Command line flag (`--theme`) 2. Frontmatter metadata (`theme:` field) -3. Environment variable (`SLIDES_THEME`) +3. Environment variable (`LANTERN_THEME`) 4. Default theme (nord for dark terminals, nord-light for light terminals) ## Custom Themes (Coming Soon) diff --git a/docs/src/quickstart.md b/docs/src/quickstart.md index 5339f1d..782e8da 100644 --- a/docs/src/quickstart.md +++ b/docs/src/quickstart.md @@ -1,18 +1,18 @@ # Quickstart -Get started with slides-rs in minutes. +Get started with lantern in minutes. ## Installation Currently, you'll need to build from source: ```bash -git clone https://github.com/yourusername/slides-rs.git -cd slides-rs +git clone https://github.com/yourusername/lantern.git +cd lantern cargo build --release ``` -The binary will be available at `target/release/slides`. +The binary will be available at `target/release/lantern`. ## Creating Your First Deck @@ -46,7 +46,7 @@ A modern terminal-based presentation tool ```rust fn main() { - println!("Hello, slides!"); + println!("Hello, lantern!"); } ``` @@ -73,7 +73,7 @@ Questions? Run the interactive TUI presenter: ```bash -slides present presentation.md +lantern present presentation.md ``` ### Navigation Keys @@ -89,19 +89,19 @@ slides present presentation.md Print all slides to stdout with formatting: ```bash -slides print presentation.md +lantern print presentation.md ``` Adjust output width: ```bash -slides print presentation.md --width 100 +lantern print presentation.md --width 100 ``` Use a specific theme: ```bash -slides print presentation.md --theme dark +lantern print presentation.md --theme nord ``` ## Slide Separators @@ -186,8 +186,8 @@ The status bar at the bottom displays: Customize defaults with environment variables: ```bash -# Set default theme (options: default, dark, light, monokai, dracula, solarized_dark, nord) -export SLIDES_THEME=dark +# Set default theme +export LANTERN_THEME=nord # Set default author (used if not in frontmatter) export USER=YourName diff --git a/ui/Cargo.toml b/ui/Cargo.toml index af8310c..1c0d27b 100644 --- a/ui/Cargo.toml +++ b/ui/Cargo.toml @@ -1,10 +1,10 @@ [package] -name = "slides-tui" +name = "lantern-ui" version = "0.1.0" edition = "2024" [dependencies] ratatui = "0.29.0" crossterm = "0.29.0" -slides-core = { path = "../core" } +lantern-core = { path = "../core" } owo-colors = "4.2.3" diff --git a/ui/src/app.rs b/ui/src/app.rs index ca501e0..94d0ac1 100644 --- a/ui/src/app.rs +++ b/ui/src/app.rs @@ -1,5 +1,5 @@ +use lantern_core::{metadata::Meta, slide::Slide, term::InputEvent, theme::ThemeColors}; use ratatui::{Terminal as RatatuiTerminal, backend::Backend}; -use slides_core::{metadata::Meta, slide::Slide, term::InputEvent, theme::ThemeColors}; use std::io; use std::time::{Duration, Instant}; @@ -91,7 +91,7 @@ impl App { #[cfg(test)] mod tests { use super::*; - use slides_core::slide::{Block, TextSpan}; + use lantern_core::slide::{Block, TextSpan}; fn create_test_app() -> App { let slides = vec![ diff --git a/ui/src/lib.rs b/ui/src/lib.rs index d310647..83aee15 100644 --- a/ui/src/lib.rs +++ b/ui/src/lib.rs @@ -8,7 +8,7 @@ pub use layout::SlideLayout; pub use renderer::render_slide_content; pub use viewer::SlideViewer; -pub use slides_core::{ +pub use lantern_core::{ slide::{Block, Slide, TextSpan}, theme::ThemeColors, }; diff --git a/ui/src/renderer.rs b/ui/src/renderer.rs index b873b67..75f624f 100644 --- a/ui/src/renderer.rs +++ b/ui/src/renderer.rs @@ -2,7 +2,7 @@ use ratatui::{ style::{Modifier, Style}, text::{Line, Span, Text}, }; -use slides_core::{ +use lantern_core::{ highlighter, slide::{Block, CodeBlock, List, Table, TextSpan, TextStyle}, theme::ThemeColors, @@ -202,7 +202,7 @@ fn apply_theme_style(theme: &ThemeColors, text_style: &TextStyle, is_heading: bo } /// Convert theme Color to ratatui Style with RGB colors -fn to_ratatui_style(color: &slides_core::theme::Color, bold: bool) -> Style { +fn to_ratatui_style(color: &lantern_core::theme::Color, bold: bool) -> Style { let mut style = Style::default().fg(ratatui::style::Color::Rgb(color.r, color.g, color.b)); if bold { @@ -214,7 +214,7 @@ fn to_ratatui_style(color: &slides_core::theme::Color, bold: bool) -> Style { #[cfg(test)] mod tests { - use slides_core::slide::ListItem; + use lantern_core::slide::ListItem; use super::*; @@ -275,7 +275,7 @@ mod tests { #[test] fn to_ratatui_style_converts_color() { - use slides_core::theme::Color; + use lantern_core::theme::Color; let color = Color::new(255, 128, 64); let style = to_ratatui_style(&color, false); @@ -285,7 +285,7 @@ mod tests { #[test] fn to_ratatui_style_applies_bold() { - use slides_core::theme::Color; + use lantern_core::theme::Color; let color = Color::new(100, 150, 200); let style = to_ratatui_style(&color, true); @@ -296,7 +296,7 @@ mod tests { #[test] fn to_ratatui_style_no_bold_when_false() { - use slides_core::theme::Color; + use lantern_core::theme::Color; let color = Color::new(100, 150, 200); let style = to_ratatui_style(&color, false); diff --git a/ui/src/viewer.rs b/ui/src/viewer.rs index 1bbae25..fa5dfac 100644 --- a/ui/src/viewer.rs +++ b/ui/src/viewer.rs @@ -5,7 +5,7 @@ use ratatui::{ text::{Line, Span}, widgets::{Block, Borders, Paragraph, Wrap}, }; -use slides_core::{slide::Slide, theme::ThemeColors}; +use lantern_core::{slide::Slide, theme::ThemeColors}; use std::time::Instant; use crate::renderer::render_slide_content; @@ -173,7 +173,7 @@ impl SlideViewer { #[cfg(test)] mod tests { use super::*; - use slides_core::slide::{Block, TextSpan}; + use lantern_core::slide::{Block, TextSpan}; fn create_test_slides() -> Vec { vec![