Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 71c5915628 | |||
| 17ae6a036e | |||
| 6c88272e58 | |||
| 0dd24e2ba4 |
8
.dockerignore
Normal file
8
.dockerignore
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
target/
|
||||||
|
.git/
|
||||||
|
.gitignore
|
||||||
|
Dockerfile
|
||||||
|
.dockerignore
|
||||||
|
README.md
|
||||||
|
.env
|
||||||
|
*.md
|
||||||
40
CHANGELOG.md
40
CHANGELOG.md
@ -5,7 +5,31 @@ The format is based on [Keep a
|
|||||||
Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to
|
Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to
|
||||||
[Semantic Versioning](https://semver.org/lang/en/).
|
[Semantic Versioning](https://semver.org/lang/en/).
|
||||||
|
|
||||||
## [0.4.1] - 2026-03-26
|
|
||||||
|
## v0.4.4 - 2026-03-29
|
||||||
|
### Fixed
|
||||||
|
- Fixed removing newlines.
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
## v0.4.3 - 2026-03-28
|
||||||
|
### Changed
|
||||||
|
- Change footer.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## v0.4.2 - 2026-03-27
|
||||||
|
### Added
|
||||||
|
- Added version and project name in footer.
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## v0.4.1 - 2026-03-26
|
||||||
### Fixed
|
### Fixed
|
||||||
- Added support for rendering individual files, not just directories (e.g.,
|
- Added support for rendering individual files, not just directories (e.g.,
|
||||||
`mdpreview dir/file.md`).
|
`mdpreview dir/file.md`).
|
||||||
@ -15,7 +39,7 @@ Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to
|
|||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
## [0.4.0] - 2026-03-25
|
## v0.4.0 - 2026-03-25
|
||||||
### Added
|
### Added
|
||||||
- Added a button to copy the edit command (`note edit current_note.md`).
|
- Added a button to copy the edit command (`note edit current_note.md`).
|
||||||
|
|
||||||
@ -23,7 +47,7 @@ Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to
|
|||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
## [0.3.0] - 2026-03-24
|
## v0.3.0 - 2026-03-24
|
||||||
### Added
|
### Added
|
||||||
- Added the `--random` flag to open the browser on a random page when used with
|
- Added the `--random` flag to open the browser on a random page when used with
|
||||||
`--browser` (`--browser --random`).
|
`--browser` (`--browser --random`).
|
||||||
@ -32,7 +56,7 @@ Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to
|
|||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
## [0.2.1] - 2026-03-23
|
## v0.2.1 - 2026-03-23
|
||||||
### Fixed
|
### Fixed
|
||||||
- Fixed an issue where listening on port 0 (`--port 0`) caused the browser to
|
- Fixed an issue where listening on port 0 (`--port 0`) caused the browser to
|
||||||
open the wrong port.
|
open the wrong port.
|
||||||
@ -41,7 +65,7 @@ Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to
|
|||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
## [0.2.0] - 2026-03-23
|
## v0.2.0 - 2026-03-23
|
||||||
### Added
|
### Added
|
||||||
- Added the `--browser` flag to automatically open the page in the browser.
|
- Added the `--browser` flag to automatically open the page in the browser.
|
||||||
|
|
||||||
@ -49,7 +73,7 @@ Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to
|
|||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
## [0.1.3] - 2026-03-23
|
## v0.1.3 - 2026-03-23
|
||||||
### Added
|
### Added
|
||||||
- Added a "Random File" button to the header.
|
- Added a "Random File" button to the header.
|
||||||
|
|
||||||
@ -65,7 +89,7 @@ Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to
|
|||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
## [0.1.2] - 2026-03-22
|
## v0.1.2 - 2026-03-22
|
||||||
### Added
|
### Added
|
||||||
- Added a "Random File" button.
|
- Added a "Random File" button.
|
||||||
- Added an "On Main" button.
|
- Added an "On Main" button.
|
||||||
@ -78,6 +102,6 @@ Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to
|
|||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
## [0.1.1] - 2026-03-21
|
## v0.1.1 - 2026-03-21
|
||||||
### Added
|
### Added
|
||||||
- Added page titles.
|
- Added page titles.
|
||||||
|
|||||||
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -982,7 +982,7 @@ checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "mdpreview"
|
name = "mdpreview"
|
||||||
version = "0.4.3"
|
version = "0.4.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"askama",
|
"askama",
|
||||||
"askama_axum",
|
"askama_axum",
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "mdpreview"
|
name = "mdpreview"
|
||||||
version = "0.4.3"
|
version = "0.4.4"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
authors = ["Vladislav Kan <thek4n@yandex.ru>"]
|
authors = ["Vladislav Kan <thek4n@yandex.ru>"]
|
||||||
|
|
||||||
|
|||||||
43
Dockerfile
Normal file
43
Dockerfile
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
FROM rust:1.94 AS chef
|
||||||
|
|
||||||
|
RUN cargo install --locked cargo-chef
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY Cargo.toml Cargo.lock .
|
||||||
|
RUN mkdir src && touch src/main.rs
|
||||||
|
|
||||||
|
RUN cargo chef prepare --recipe-path recipe.json
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
FROM chef AS builder
|
||||||
|
|
||||||
|
COPY --from=chef /app/recipe.json recipe.json
|
||||||
|
|
||||||
|
RUN cargo chef cook --release --recipe-path recipe.json
|
||||||
|
|
||||||
|
|
||||||
|
COPY rust-toolchain.toml rust-toolchain.toml
|
||||||
|
|
||||||
|
RUN cargo fetch
|
||||||
|
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
RUN cargo build --release
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
FROM debian:bookworm-slim AS runtime
|
||||||
|
|
||||||
|
RUN useradd -m -s /bin/bash appuser
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY --from=builder /app/target/release/mdpreview /usr/local/bin/mdpreview
|
||||||
|
|
||||||
|
USER appuser
|
||||||
|
|
||||||
|
EXPOSE 8080
|
||||||
|
|
||||||
|
CMD ["mdpreview"]
|
||||||
@ -1,3 +1,3 @@
|
|||||||
[toolchain]
|
[toolchain]
|
||||||
channel = "stable"
|
channel = "stable"
|
||||||
components = ["clippy", "rustfmt", "chef"]
|
components = ["clippy", "rustfmt"]
|
||||||
|
|||||||
@ -127,10 +127,13 @@ pub fn markdown_to_html(markdown: &str, ss: &SyntaxSet, ts: &ThemeSet, _file_pat
|
|||||||
IncludeBackground::No,
|
IncludeBackground::No,
|
||||||
)
|
)
|
||||||
.unwrap_or_else(|_| escape_html(&line));
|
.unwrap_or_else(|_| escape_html(&line));
|
||||||
|
|
||||||
result_html.push_str(&html_line);
|
result_html.push_str(&html_line);
|
||||||
|
result_html.push('\n');
|
||||||
}
|
}
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
result_html.push_str(&escape_html(&line));
|
result_html.push_str(&escape_html(&line));
|
||||||
|
result_html.push('\n');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user