Skip to content

Commit f9871c2

Browse files
committed
Extract cio_markdown subpackage
This allows us to isolate our markdown rendering code in a dedicated package, which could potentially have a positive effect on the compile times of the full project. It also means we can iterate on this part of the code independent from the other parts, and with a well-specified API interface.
1 parent 71b1627 commit f9871c2

File tree

6 files changed

+591
-564
lines changed

6 files changed

+591
-564
lines changed

Cargo.lock

Lines changed: 11 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,12 @@ rustdoc-args = [
3030
]
3131

3232
[dependencies]
33-
ammonia = "3.0.0"
3433
anyhow = "1.0"
3534
base64 = "0.13"
3635
cargo-registry-s3 = { path = "src/s3", version = "0.2.0" }
3736
chrono = { version = "0.4.0", features = ["serde"] }
37+
cio_markdown = { path = "src/markdown" }
3838
clap = "=3.0.0-beta.4"
39-
comrak = { version = "0.10.1", default-features = false }
4039

4140
conduit = "0.9.0-alpha.5"
4241
conduit-conditional-get = "0.9.0-alpha.3"
@@ -61,7 +60,6 @@ futures-util = "0.3"
6160
git2 = "0.13.0"
6261
handlebars = "4.1.3"
6362
hex = "0.4"
64-
htmlescape = "0.3.1"
6563
http = "0.2"
6664
hyper = { version = "0.14", features = ["client", "http1"] }
6765
indexmap = { version = "1.0.2", features = ["serde-1"] }

src/admin/render_readmes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
use crate::{
22
config, db,
33
models::Version,
4-
render::readme_to_html,
54
schema::{crates, readme_renderings, versions},
65
uploaders::Uploader,
76
};
87
use std::{io::Read, path::Path, sync::Arc, thread};
98

109
use chrono::{TimeZone, Utc};
10+
use cio_markdown::readme_to_html;
1111
use clap::Clap;
1212
use diesel::{dsl::any, prelude::*};
1313
use flate2::read::GzDecoder;

src/markdown/Cargo.toml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[package]
2+
3+
name = "cio_markdown"
4+
version = "0.0.0"
5+
license = "MIT OR Apache-2.0"
6+
repository = "https://github.com/rust-lang/crates.io"
7+
description = "crates.io markdown renderer"
8+
edition = "2018"
9+
resolver = "2"
10+
11+
[lib]
12+
path = "lib.rs"
13+
14+
[dependencies]
15+
ammonia = "3.1.2"
16+
comrak = { version = "0.10.1", default-features = false }
17+
htmlescape = "0.3.1"
18+
url = "2.2.2"

0 commit comments

Comments
 (0)