Skip to content

Commit 566a42c

Browse files
authored
Merge pull request #2674 from ehuss/fix-missing-docs
Clean up some missing docs
2 parents c948fe4 + 6e143ce commit 566a42c

File tree

5 files changed

+25
-3
lines changed

5 files changed

+25
-3
lines changed

.github/workflows/main.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,18 @@ jobs:
9898
- run: rustup component add clippy
9999
- run: cargo clippy --workspace --all-targets --no-deps -- -D warnings
100100

101+
docs:
102+
name: Check API docs
103+
runs-on: ubuntu-latest
104+
steps:
105+
- uses: actions/checkout@v4
106+
- name: Install Rust
107+
run: bash ci/install-rust.sh stable x86_64-unknown-linux-gnu
108+
- name: Ensure intradoc links are valid
109+
run: cargo doc --workspace --document-private-items --no-deps
110+
env:
111+
RUSTDOCFLAGS: -D warnings
112+
101113
# The success job is here to consolidate the total success/failure state of
102114
# all other jobs. This job is then included in the GitHub branch protection
103115
# rule which prevents merges unless all other jobs are passing. This makes
@@ -112,6 +124,7 @@ jobs:
112124
- aarch64-cross-builds
113125
- gui
114126
- clippy
127+
- docs
115128
runs-on: ubuntu-latest
116129
steps:
117130
- run: jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'

src/renderer/html_handlebars/hbs_renderer.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,12 @@ use once_cell::sync::Lazy;
2020
use regex::{Captures, Regex};
2121
use serde_json::json;
2222

23+
/// The HTML renderer for mdBook.
2324
#[derive(Default)]
2425
pub struct HtmlHandlebars;
2526

2627
impl HtmlHandlebars {
28+
/// Returns a new instance of [`HtmlHandlebars`].
2729
pub fn new() -> Self {
2830
HtmlHandlebars
2931
}

src/renderer/html_handlebars/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![allow(missing_docs)] // FIXME: Document this
2-
31
pub use self::hbs_renderer::HtmlHandlebars;
42
pub use self::static_files::StaticFiles;
53

src/utils/fs.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! Filesystem utilities and helpers.
2+
13
use crate::errors::*;
24
use log::{debug, trace};
35
use std::fs::{self, File};
@@ -202,6 +204,7 @@ fn copy<P: AsRef<Path>, Q: AsRef<Path>>(from: P, to: Q) -> Result<()> {
202204
}
203205
}
204206

207+
/// Returns the name of the file used for HTTP 404 "not found" with the `.html` extension.
205208
pub fn get_404_output_file(input_404: &Option<String>) -> String {
206209
input_404
207210
.as_ref()

src/utils/mod.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![allow(missing_docs)] // FIXME: Document this
1+
//! Various helpers and utilities.
22
33
pub mod fs;
44
mod string;
@@ -194,6 +194,7 @@ pub fn render_markdown(text: &str, smart_punctuation: bool) -> String {
194194
render_markdown_with_path(text, smart_punctuation, None)
195195
}
196196

197+
/// Creates a new pulldown-cmark parser of the given text.
197198
pub fn new_cmark_parser(text: &str, smart_punctuation: bool) -> Parser<'_> {
198199
let mut opts = Options::empty();
199200
opts.insert(Options::ENABLE_TABLES);
@@ -207,6 +208,11 @@ pub fn new_cmark_parser(text: &str, smart_punctuation: bool) -> Parser<'_> {
207208
Parser::new_ext(text, opts)
208209
}
209210

211+
/// Renders markdown to HTML.
212+
///
213+
/// `path` should only be set if this is being generated for the consolidated
214+
/// print page. It should point to the page being rendered relative to the
215+
/// root of the book.
210216
pub fn render_markdown_with_path(
211217
text: &str,
212218
smart_punctuation: bool,

0 commit comments

Comments
 (0)