Skip to content

Hosting mdbook with gh-pages #111

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MDBOOK_VERSION=0.4.4
31 changes: 31 additions & 0 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: github pages

on:
push:
branches:
- master

jobs:
deploy:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2

- name: Read .env
id: mdbook-version
run: |
. ./.env
echo "::set-output name=MDBOOK_VERSION::${MDBOOK_VERSION}"

- name: Setup mdbook
uses: peaceiris/actions-mdbook@v1
with:
mdbook-version: '${{ steps.mdbook-version.outputs.MDBOOK_VERSION }}'

- run: mdbook build

- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./book
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Generated output of mdbook
/book
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,20 @@ We suggest leaving a comment on the [issue tracker](https://github.com/rust-unof
so that other people don't start working on the same topic.

Correction and elaboration PRs are very welcome.

## Building with mdbook

This book is built with [mdbook](https://rust-lang.github.io/mdBook/). You can install it by running `cargo install mdbook`.

If you want to build it locally you can run one of these two commands in the root directory of the repository:

- `mdbook build`

Builds static html pages as output and place them in the `/book` directory by default.

- `mdbook serve`

Serves the book at `http://localhost:3000` (port is changeable, take a look at the terminal output
to be sure) and reloads the browser when a change occurs.


32 changes: 32 additions & 0 deletions SUMMARY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Summary

- [Introduction](./intro.md)
- [Idioms](./idioms/README.md)
- [Concatenating Strings with `format!`](./idioms/concat-format.md)
- [Constructor](./idioms/ctor.md)
- [The `Default` Trait](./idioms/default.md)
- [Collections Are Smart Pointers](./idioms/deref.md)
- [Finalisation in Destructors](./idioms/dtor-finally.md)
- [`mem::replace(_)`](./idioms/mem-replace.md)
- [On-Stack Dynamic Dispatch](./idioms/on-stack-dyn-dispatch.md)
- [Iterating over an `Option`](./idioms/option-iter.md)
- [Pass Variables to Closure](./idioms/pass-var-to-closure.md)
- [Privacy For Extensibility](./idioms/priv-extend.md)
- [Easy doc initialization](./idioms/rustdoc-init.md)
- [Temporary mutability](./idioms/temporary-mutability.md)

- [Design Patterns](./patterns/README.md)
- [Builder](./patterns/builder.md)
- [Compose Structs](./patterns/compose-structs.md)
- [Entry API](./patterns/entry.md)
- [Fold](./patterns/fold.md)
- [Late Bound Bounds](./patterns/late-bounds.md)
- [Newtype](./patterns/newtype.md)
- [RAII Guards](./patterns/RAII.md)
- [Prefer Small Crates](./patterns/small-crates.md)
- [Contain unsafety in small modules](./patterns/unsafe-mods.md)
- [Visitor](./patterns/visitor.md)

- [Anti-patterns](./anti_patterns/README.md)
- [`#[deny(warnings)]`](./anti_patterns/deny-warnings.md)
- [Deref Polymorphism](./anti_patterns/deref.md)
3 changes: 3 additions & 0 deletions anti_patterns/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Anti-patterns

TODO: add description/explanation
20 changes: 20 additions & 0 deletions book.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[book]
title = "Rust Design Patterns"
authors = ["the rust-unofficial authors"]
description = "A catalogue of Rust design patterns, anti-patterns and idioms"
language = "en"
multilingual = false
src = "."

[build]
create-missing = false

[rust]
edition = "2018"

[output.html]
default-theme = "rust"
git-repository-url = "https://github.com/rust-unofficial/patterns"
git-repository-icon = "fa-github"

# [output.linkcheck] # enable the "mdbook-linkcheck" renderer, disabled due to gh-actions
3 changes: 3 additions & 0 deletions idioms/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Idioms

TODO: add description/explanation
3 changes: 3 additions & 0 deletions patterns/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Design Patterns

TODO: add description/explanation