Skip to content

Commit

Permalink
feat: use mdbook-last-changed to indicate when a file has been last u…
Browse files Browse the repository at this point in the history
…pdated
  • Loading branch information
simonsan committed Mar 17, 2024
1 parent 6f8e91a commit 9a69ea6
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 2 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
MDBOOK_VERSION=0.4.37
MDBOOK_I18N_HELPERS_VERSION=0.3.2
MDBOOK_PANDOC_VERSION=0.6.0
MDBOOK_LAST_CHANGED_VERSION=0.1.4
9 changes: 8 additions & 1 deletion .github/workflows/install-mdbook/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,17 @@ runs:
echo "version=$MDBOOK_PANDOC_VERSION" >> $GITHUB_OUTPUT
shell: bash

- name: Read mdbook-last-changed version from .env
id: mdbook-last-changed-version
run: |
. ./.env
echo "version=$MDBOOK_LAST_CHANGED_VERSION" >> $GITHUB_OUTPUT
shell: bash

- name: Install dependencies
uses: taiki-e/install-action@v2
with:
tool: mdbook@${{ steps.mdbook-version.outputs.version }},mdbook-pandoc@${{ steps.mdbook-pandoc-version.outputs.version }},mdbook-i18n-helpers@${{ steps.mdbook-i18n-helpers-version.outputs.version }}
tool: mdbook@${{ steps.mdbook-version.outputs.version }},mdbook-pandoc@${{ steps.mdbook-pandoc-version.outputs.version }},mdbook-i18n-helpers@${{ steps.mdbook-i18n-helpers-version.outputs.version }},mdbook-last-changed@${{ steps.mdbook-last-changed-version.outputs.version }}

- name: Install mdbook-pandoc and related dependencies
run: |
Expand Down
9 changes: 8 additions & 1 deletion book.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,14 @@ site-url = "/patterns/"
git-repository-url = "https://github.com/rust-unofficial/patterns"
git-repository-icon = "fa-github"
edit-url-template = "https://github.com/rust-unofficial/patterns/edit/main/{path}"
additional-css = ["theme/css/language-picker.css"]
additional-css = [
"./theme/css/language-picker.css",
"./styles/last-changed.css",
]

[preprocessor.last-changed]
command = "mdbook-last-changed"
renderer = ["html"]

[output.html.fold]
enable = true
Expand Down
7 changes: 7 additions & 0 deletions styles/last-changed.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
footer {
font-size: 0.8em;
text-align: center;
border-top: 1px solid grey;
padding: 1.25em 0;
margin-top: 1.25em;
}

0 comments on commit 9a69ea6

Please sign in to comment.