Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v0.3.2 backportapalooza #170

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
ecda11e
Some clean ups, fixes, config flag (#91)
coastalwhite May 10, 2023
dc5535d
Support bare relative links (#103)
CosmicHorrorDev May 11, 2023
c101a7a
Attempt to reregister file watcher on file "removal" (#106)
CosmicHorrorDev May 14, 2023
9b67377
Add a test for all CLI options (#116)
CosmicHorrorDev May 15, 2023
915d403
Add repology badge for package manager installation (#109)
CosmicHorrorDev May 17, 2023
c3c2e07
Make correct location of `inlyne.toml` file clearer (#122)
nicoburns May 20, 2023
66985d1
Interpreter testing (#132)
CosmicHorrorDev May 31, 2023
de42d67
Interpreter test tweaks (#138)
CosmicHorrorDev Jun 3, 2023
292aa9f
More robust file watching (#147)
CosmicHorrorDev Jun 21, 2023
cc2c1dc
Make file reloading less panic happy (#145)
CosmicHorrorDev Jun 21, 2023
7dadd14
Improve syntax highlighting (#150)
CosmicHorrorDev Jul 11, 2023
bec2fe8
Retry watcher test with increased delays (#155)
CosmicHorrorDev Jul 22, 2023
c01b626
Fix-up nested lists (#154)
CosmicHorrorDev Jul 22, 2023
87e4586
Dogfood new `smart-debug` crate (#156)
CosmicHorrorDev Jul 23, 2023
326c8a2
Dont ignore locked mutex in debug impl (#166)
CosmicHorrorDev Nov 1, 2023
4a33986
fix: add missing `fontdb` feature flag (#169)
AlphaKeks Nov 10, 2023
33220ac
Add relevant keywords to `Cargo.toml` (#171)
CosmicHorrorDev Nov 19, 2023
d63d483
Use `human-panic` for a custom panic hook (#172)
CosmicHorrorDev Nov 19, 2023
a468ad8
`cargo upgragde`
CosmicHorrorDev Nov 23, 2023
af47c5e
Update `two-face`
CosmicHorrorDev Nov 23, 2023
0b933d9
`cargo update`
CosmicHorrorDev Nov 23, 2023
fc8bfed
Update simple dependencies
CosmicHorrorDev Nov 23, 2023
767e3b8
Update `smart-debug`
CosmicHorrorDev Nov 23, 2023
a26509e
Update `resvg` & co.
CosmicHorrorDev Nov 23, 2023
5f4fffd
Update `rust-version` to v1.70.0
CosmicHorrorDev Nov 23, 2023
f7462e5
Bump version to v0.3.2
CosmicHorrorDev Nov 23, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,467 changes: 1,648 additions & 819 deletions Cargo.lock

Large diffs are not rendered by default.

63 changes: 36 additions & 27 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,54 +1,63 @@
[package]
name = "inlyne"
version = "0.3.1"
version = "0.3.2"
description = "Introducing Inlyne, a GPU powered yet browserless tool to help you quickly view markdown files in the blink of an eye."
edition = "2021"
authors = ["trimental"]
license = "MIT"
readme = "README.md"
repository = "https://github.com/trimental/inlyne"
homepage = "https://github.com/trimental/inlyne"
rust-version = "1.70"
keywords = ["markdown", "viewer", "gpu"]

[dependencies]
wgpu_glyph = "0.20"
winit = "0.28.5"
wgpu = "0.16"
bytemuck = "1.13.1"
wgpu_glyph = "0.21"
winit = "0.28.7"
wgpu = "0.17"
bytemuck = "1.14.0"
lyon = "1.0.1"
comrak = { version = "0.18.0", default-features = false, features = ["syntect"] }
open = "4.1.0"
comrak = { version = "0.19.0", default-features = false, features = ["syntect"] }
open = "5.0.1"
html5ever = "0.26.0"
image = "0.24.6"
clap = { version = "4.2.7", features = ["cargo"] }
copypasta = "0.8.2"
resvg = "0.32.0"
usvg = "0.32.0"
tiny-skia = "0.9.0"
anyhow = "1.0.71"
image = "0.24.7"
clap = { version = "4.3.24", features = ["cargo"] }
copypasta = "0.10.0"
resvg = "0.36"
usvg = "0.36"
tiny-skia = "0.11"
anyhow = "1.0.75"
dirs = "5.0.1"
serde = { version = "1.0.162", features = ["derive"] }
toml = "0.7.3"
reqwest = { version = "0.11.17", features = ["blocking", "json", "stream"] }
serde = { version = "1.0.193", features = ["derive"] }
toml = "0.7.6"
reqwest = { version = "0.11.22", features = ["blocking", "json", "stream"] }
font-kit = "0.11.0"
memmap2 = "0.5.10"
log = "0.4.17"
env_logger = "0.10.0"
notify = "5.1.0"
clap_complete = "4.2.1"
memmap2 = "0.9.0"
log = "0.4.20"
env_logger = "0.10.1"
notify = "6.1.1"
clap_complete = "4.3.2"
dark-light = "1.0.0"
# We only decompress our own compressed data, so disable `safe-decode` and
# `checked-decode`
lz4_flex = { version = "0.10.0", default-features = false, features = ["frame", "safe-encode", "std"] }
lz4_flex = { version = "0.11.1", default-features = false, features = ["frame", "safe-encode", "std"] }
pollster = "0.3.0"
smart-debug = "0.0.3"
syntect = "5.1.0"
two-face = "0.3.0"

# Uncomment for profiling
# [profile.release]
# debug = true
# Required for WGPU to work properly with Vulkan
fontdb = { version = "0.16.0", features = ["fontconfig"] }
human-panic = "1.2.2"

[profile.release-lto]
inherits = "release"
strip = true
lto = true

[dev-dependencies]
pretty_assertions = "1.3.0"
filetime = "0.2.22"
insta = "1.34.0"
pretty_assertions = "1.4.0"
tempfile = "3.8.1"
wiremock = "0.5.21"
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ view markdown files in the blink of an eye.
## Install

To install just use `cargo install inlyne`, everything comes pre-bundled.
Alternatively you can install through various package managers.

[![Packaging status](https://repology.org/badge/vertical-allrepos/inlyne.svg)](https://repology.org/project/inlyne/versions)

## Features

Expand Down Expand Up @@ -90,7 +93,13 @@ You weren't supposed to see this!

## Configuration

Use `inlyne --help` to see all the command line options. Some of which can be set permentantly by placing an `inlyne.toml` file into the default [dirs](https://crates.io/crates/dirs) configuration folder for your respective OS. Checkout `inlyne.toml.sample` for an example configuration.
Use `inlyne --help` to see all the command line options. Some of which can be set permentantly by placing an `inlyne.toml` file into a directory called `inlyne` within the default [dirs](https://crates.io/crates/dirs) configuration folder for your respective OS:

- Linux: `/home/alice/.config/inlyne/inlyne.toml`
- Windows: `C:\Users\Alice\AppData\Roaming\inlyne\inlyne.toml`
- Mac: `/Users/Alice/Library/Application Support/inlyne/inlyne.toml`

Checkout `inlyne.toml.sample` for an example configuration.

## FAQ

Expand Down
176 changes: 176 additions & 0 deletions src/debug_impls.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
//! A whole load of custom debug impls to keep the output more succinct
//!
//! Mostly to reduce noise for snapshot tests, but also good in general

use std::fmt;

use crate::{positioner::Spacer, text::Text};

pub struct DebugInlineMaybeF32Color<'a>(pub &'a Option<[f32; 4]>);

impl fmt::Debug for DebugInlineMaybeF32Color<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self.0 {
None => f.write_str("None"),
Some(rgba) => f.write_fmt(format_args!("Some({:?})", DebugF32Color(*rgba))),
}
}
}

pub struct DebugF32Color(pub [f32; 4]);

impl fmt::Debug for DebugF32Color {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
if self.0 == [0.0, 0.0, 0.0, 1.0] {
f.write_str("Color(BLACK)")
} else {
let Self([r, g, b, a]) = self;

if *a == 1.0 {
f.write_fmt(format_args!("Color {{ r: {r:.2}, g: {g:.2}, b: {b:.2} }}"))
} else {
f.write_fmt(format_args!(
"Color {{ r: {r:.2}, g: {g:.2}, b: {b:.2}, a: {a:.2} }}"
))
}
}
}
}

pub struct DebugInline<'inner, T>(pub &'inner T);

impl<T: fmt::Debug> fmt::Debug for DebugInline<'_, T> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_fmt(format_args!("{:?}", self.0))
}
}

fn debug_inline_some<T: fmt::Debug>(
debug: &mut fmt::DebugStruct<'_, '_>,
name: &'static str,
maybe_t: &Option<T>,
) {
if maybe_t.is_some() {
debug.field(name, &DebugInline(maybe_t));
}
}

pub struct DebugBytesPrefix<'a>(pub &'a [u8]);

impl<'a> fmt::Debug for DebugBytesPrefix<'a> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self.0 {
[x, y, z, _, ..] => {
let len = self.0.len();
f.write_fmt(format_args!("{{ len: {len}, data: [{x}, {y}, {z}, ..] }}"))
}
three_or_less => f.write_fmt(format_args!("{three_or_less:?}")),
}
}
}

pub fn text(text: &Text, f: &mut fmt::Formatter<'_>) -> fmt::Result {
#[derive(Copy, Clone)]
struct StyleWrapper {
is_bold: bool,
is_italic: bool,
is_underlined: bool,
is_striked: bool,
}

impl StyleWrapper {
fn is_regular(self) -> bool {
let Self {
is_bold,
is_italic,
is_underlined,
is_striked,
} = self;

![is_bold, is_italic, is_underlined, is_striked].contains(&true)
}
}

impl fmt::Debug for StyleWrapper {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let Self {
is_bold,
is_italic,
is_underlined,
is_striked,
} = *self;

if self.is_regular() {
f.write_str("REGULAR")?;
} else {
if is_bold {
f.write_str("BOLD ")?;
}
if is_italic {
f.write_str("ITALIC ")?;
}
if is_underlined {
f.write_str("UNDERLINED ")?;
}
if is_striked {
f.write_str("STRIKED ")?;
}
}

Ok(())
}
}

let Text {
text,
size,
color,
link,
is_bold,
is_italic,
is_underlined,
is_striked,
font: _,
// Globally consistent so avoid displaying as noise
hidpi_scale: _,
default_color,
} = text;

let mut debug = f.debug_struct("Text");

// Fields that we will always display
debug.field("text", text);

// Fields that we only display when set to unique values
if *size != 16.0 {
debug.field("size", size);
}
if color.is_none() {
debug.field("default_color", &DebugF32Color(*default_color));
} else {
let color = color.map(DebugF32Color);
debug.field("color", &DebugInline(&color));
}
let style = StyleWrapper {
is_bold: *is_bold,
is_italic: *is_italic,
is_underlined: *is_underlined,
is_striked: *is_striked,
};
if !style.is_regular() {
debug.field("style", &style);
}
debug_inline_some(&mut debug, "link", link);

debug.finish_non_exhaustive()
}

pub fn spacer(spacer: &Spacer, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let Spacer { space, visible } = spacer;

if *visible {
f.write_fmt(format_args!("VisibleSpacer({space})"))
} else {
f.write_fmt(format_args!("InvisibleSpacer({space})"))
}
}
Loading