Skip to content

Commit b1c2e46

Browse files
authored
Merge pull request #1438 from pierwill/edit-docs
Add intra-docs links to docs
2 parents 218e200 + cdea0f6 commit b1c2e46

File tree

6 files changed

+20
-25
lines changed

6 files changed

+20
-25
lines changed

src/book/book.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ fn create_missing(src_dir: &Path, summary: &Summary) -> Result<()> {
6666

6767
/// A dumb tree structure representing a book.
6868
///
69-
/// For the moment a book is just a collection of `BookItems` which are
69+
/// For the moment a book is just a collection of [`BookItems`] which are
7070
/// accessible by either iterating (immutably) over the book with [`iter()`], or
7171
/// recursively applying a closure to each section to mutate the chapters, using
7272
/// [`for_each_mut()`].
@@ -160,7 +160,7 @@ pub struct Chapter {
160160
pub sub_items: Vec<BookItem>,
161161
/// The chapter's location, relative to the `SUMMARY.md` file.
162162
pub path: Option<PathBuf>,
163-
/// An ordered list of the names of each chapter above this one, in the hierarchy.
163+
/// An ordered list of the names of each chapter above this one in the hierarchy.
164164
pub parent_names: Vec<String>,
165165
}
166166

@@ -181,8 +181,8 @@ impl Chapter {
181181
}
182182
}
183183

184-
/// Create a new draft chapter that is not attached to a source markdown file and has
185-
/// thus no content.
184+
/// Create a new draft chapter that is not attached to a source markdown file (and thus
185+
/// has no content).
186186
pub fn new_draft(name: &str, parent_names: Vec<String>) -> Self {
187187
Chapter {
188188
name: name.to_string(),
@@ -193,7 +193,7 @@ impl Chapter {
193193
}
194194
}
195195

196-
/// Check if the chapter is a draft chapter, meaning it has no path to a source markdown file
196+
/// Check if the chapter is a draft chapter, meaning it has no path to a source markdown file.
197197
pub fn is_draft_chapter(&self) -> bool {
198198
match self.path {
199199
Some(_) => false,
@@ -302,8 +302,6 @@ fn load_chapter<P: AsRef<Path>>(
302302
///
303303
/// This struct shouldn't be created directly, instead prefer the
304304
/// [`Book::iter()`] method.
305-
///
306-
/// [`Book::iter()`]: struct.Book.html#method.iter
307305
pub struct BookItems<'a> {
308306
items: VecDeque<&'a BookItem>,
309307
}

src/book/init.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ impl BookBuilder {
2828
}
2929
}
3030

31-
/// Set the `Config` to be used.
31+
/// Set the [`Config`] to be used.
3232
pub fn with_config(&mut self, cfg: Config) -> &mut BookBuilder {
3333
self.config = cfg;
3434
self

src/book/mod.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ pub struct MDBook {
4040
pub book: Book,
4141
renderers: Vec<Box<dyn Renderer>>,
4242

43-
/// List of pre-processors to be run on the book
43+
/// List of pre-processors to be run on the book.
4444
preprocessors: Vec<Box<dyn Preprocessor>>,
4545
}
4646

@@ -78,7 +78,7 @@ impl MDBook {
7878
MDBook::load_with_config(book_root, config)
7979
}
8080

81-
/// Load a book from its root directory using a custom config.
81+
/// Load a book from its root directory using a custom `Config`.
8282
pub fn load_with_config<P: Into<PathBuf>>(book_root: P, config: Config) -> Result<MDBook> {
8383
let root = book_root.into();
8484

@@ -97,7 +97,7 @@ impl MDBook {
9797
})
9898
}
9999

100-
/// Load a book from its root directory using a custom config and a custom summary.
100+
/// Load a book from its root directory using a custom `Config` and a custom summary.
101101
pub fn load_with_config_and_summary<P: Into<PathBuf>>(
102102
book_root: P,
103103
config: Config,
@@ -121,7 +121,7 @@ impl MDBook {
121121
}
122122

123123
/// Returns a flat depth-first iterator over the elements of the book,
124-
/// it returns an [BookItem enum](bookitem.html):
124+
/// it returns a [`BookItem`] enum:
125125
/// `(section: String, bookitem: &BookItem)`
126126
///
127127
/// ```no_run
@@ -180,7 +180,7 @@ impl MDBook {
180180
Ok(())
181181
}
182182

183-
/// Run the entire build process for a particular `Renderer`.
183+
/// Run the entire build process for a particular [`Renderer`].
184184
pub fn execute_build_process(&self, renderer: &dyn Renderer) -> Result<()> {
185185
let mut preprocessed_book = self.book.clone();
186186
let preprocess_ctx = PreprocessorContext::new(
@@ -219,14 +219,14 @@ impl MDBook {
219219
}
220220

221221
/// You can change the default renderer to another one by using this method.
222-
/// The only requirement is for your renderer to implement the [`Renderer`
223-
/// trait](../renderer/trait.Renderer.html)
222+
/// The only requirement is that your renderer implement the [`Renderer`]
223+
/// trait.
224224
pub fn with_renderer<R: Renderer + 'static>(&mut self, renderer: R) -> &mut Self {
225225
self.renderers.push(Box::new(renderer));
226226
self
227227
}
228228

229-
/// Register a [`Preprocessor`](../preprocess/trait.Preprocessor.html) to be used when rendering the book.
229+
/// Register a [`Preprocessor`] to be used when rendering the book.
230230
pub fn with_preprocessor<P: Preprocessor + 'static>(&mut self, preprocessor: P) -> &mut Self {
231231
self.preprocessors.push(Box::new(preprocessor));
232232
self
@@ -303,7 +303,7 @@ impl MDBook {
303303
/// artefacts.
304304
///
305305
/// If there is only 1 renderer, put it in the directory pointed to by the
306-
/// `build.build_dir` key in `Config`. If there is more than one then the
306+
/// `build.build_dir` key in [`Config`]. If there is more than one then the
307307
/// renderer gets its own directory within the main build dir.
308308
///
309309
/// i.e. If there were only one renderer (in this case, the HTML renderer):

src/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//!
33
//! The main entrypoint of the `config` module is the `Config` struct. This acts
44
//! essentially as a bag of configuration information, with a couple
5-
//! pre-determined tables (`BookConfig` and `BuildConfig`) as well as support
5+
//! pre-determined tables ([`BookConfig`] and [`BuildConfig`]) as well as support
66
//! for arbitrary data which is exposed to plugins and alternative backends.
77
//!
88
//!

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@
7676
//! access to the various methods for working with the [`Config`].
7777
//!
7878
//! [user guide]: https://rust-lang.github.io/mdBook/
79-
//! [`RenderContext`]: renderer/struct.RenderContext.html
79+
//! [`RenderContext`]: renderer::RenderContext
8080
//! [relevant chapter]: https://rust-lang.github.io/mdBook/for_developers/backends.html
81-
//! [`Config`]: config/struct.Config.html
81+
//! [`Config`]: config::Config
8282
8383
#![deny(missing_docs)]
8484
#![deny(rust_2018_idioms)]

src/renderer/mod.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,9 @@ use toml::Value;
3434
/// provide your own renderer, there are two main renderer implementations that
3535
/// 99% of users will ever use:
3636
///
37-
/// - [HtmlHandlebars] - the built-in HTML renderer
38-
/// - [CmdRenderer] - a generic renderer which shells out to a program to do the
37+
/// - [`HtmlHandlebars`] - the built-in HTML renderer
38+
/// - [`CmdRenderer`] - a generic renderer which shells out to a program to do the
3939
/// actual rendering
40-
///
41-
/// [HtmlHandlebars]: struct.HtmlHandlebars.html
42-
/// [CmdRenderer]: struct.CmdRenderer.html
4340
pub trait Renderer {
4441
/// The `Renderer`'s name.
4542
fn name(&self) -> &str;

0 commit comments

Comments
 (0)