Skip to content

Commit 2df42ae

Browse files
committed
Auto merge of #3926 - Turbo87:cio-markdown, r=jtgeibel
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 (see #3861 or #3297), and with a well-defined API interface.
2 parents b948e62 + f9871c2 commit 2df42ae

File tree

7 files changed

+593
-566
lines changed

7 files changed

+593
-566
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,11 +218,11 @@ jobs:
218218

219219
- name: Run tests (with coverage report)
220220
if: matrix.rust == 'stable'
221-
run: cargo tarpaulin --avoid-cfg-tarpaulin
221+
run: cargo tarpaulin --avoid-cfg-tarpaulin --workspace
222222

223223
- name: Run tests
224224
if: matrix.rust != 'stable'
225-
run: cargo test
225+
run: cargo test --workspace
226226

227227
- name: Prune unnecessary cache
228228
run: script/ci/prune-cache.sh

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)