actix_mark/lib.rs
1//! `actix_mark` — serve Markdown files as HTML from an actix-web application.
2//!
3//! Drop `MarkdownFiles` into your app the same way you would `actix_files::Files`.
4//! Requests for `.md` content are intercepted, converted to HTML with
5//! [pulldown-cmark](https://docs.rs/pulldown-cmark), and injected into your
6//! HTML template at the `<markdown>` tag. All other files in the directory
7//! are served as-is.
8//!
9//! # Quick start
10//!
11//! ```no_run
12//! use actix_web::{App, HttpServer};
13//! use actix_mark::MarkdownFiles;
14//!
15//! const TEMPLATE: &str = "<html><body><markdown></body></html>";
16//!
17//! #[actix_web::main]
18//! async fn main() -> std::io::Result<()> {
19//! HttpServer::new(|| {
20//! App::new().service(
21//! MarkdownFiles::new("/docs", "./content")
22//! .template(TEMPLATE),
23//! )
24//! })
25//! .bind("127.0.0.1:8080")?
26//! .run()
27//! .await
28//! }
29//! ```
30
31mod markdown;
32mod service;
33mod template;
34
35pub use service::{md_url, MarkdownFiles};