Skip to content

Commit

Permalink
Merge pull request #8816 from wmontwe/change-mdbook-setup
Browse files Browse the repository at this point in the history
Change mdbook setup
  • Loading branch information
wmontwe authored Feb 21, 2025
2 parents 946e13b + 0336beb commit 1201e33
Show file tree
Hide file tree
Showing 26 changed files with 2,796 additions and 1,746 deletions.
66 changes: 66 additions & 0 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Deploy docs

on:
push:
branches:
- main
paths:
- 'docs/**'

workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: "pages"
cancel-in-progress: false

jobs:
build-docs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: |
~/.cargo/.crates.toml
~/.cargo/.crates2.toml
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Install mdbook and extensions
run: ./docs/install.sh

- name: Setup Pages
id: pages
uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5.0.0

- name: Build docs
run: mdbook build docs --dest-dir=book/docs/latest

- name: Test docs
run: mdbook test docs

- name: Upload artifact
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1
with:
path: ./book/docs

deploy-docs:
environment:
name: pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build-docs
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ local.properties
# Kotlin
.kotlin/

# mdBook
book/

# Generated folders
bin/
build/
Expand Down
3 changes: 3 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# About Thunderbird for Android

This document provides an overview of the Thunderbird for Android project.
18 changes: 9 additions & 9 deletions docs/RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
1. Create a `.signing` folder in the root of the Git repository, if it doesn't exist yet.
2. Download the `k9-release-signing.jks` and `k9.release.signing.properties` files from 1Password and place them in the `.signing` folder.

Example `<app>.<realeaseType>.signing.properties` file:
Example `<app>.<releaseType>.signing.properties` file:

```
<app>.<releaseType>.storeFile=<path to keystore '../.signing/k9mail.jks'>
```properties
<app>.<releaseType>.storeFile=<path to keystore "../.signing/k9mail.jks">
<app>.<releaseType>.storePassword=<storePassword>
<app>.<releaseType>.keyAlias=<keyAlias>
<app>.<releaseType>.keyPassword=<keyPassword>
Expand All @@ -23,21 +23,21 @@ Example `<app>.<realeaseType>.signing.properties` file:
the [installation instructions](https://f-droid.org/docs/Installing_the_Server_and_Repo_Tools).
1. On MacOS, it's best to install the latest version from source, because the version in Homebrew has some issues.
1. Install the android command line tools if not available already.
```
```shell
brew install --cask android-commandlinetools
```
2. Install latest _fdroidserver_ from source:
```
```shell
python -m venv fdroidserver-env
source fdroidserver-env/bin/activate
pip install git+https://gitlab.com/fdroid/fdroidserver.git
```
3. To use _fdroidserver_ from the command line, you need to activate the virtual environment before each use:
```
```shell
source fdroidserver-env/bin/activate
```
4. To deactivate the virtual environment:
```
```shell
deactivate
```
2. [Sign up for a Gitlab account](https://gitlab.com/users/sign_up) and fork
Expand All @@ -56,7 +56,7 @@ Example `<app>.<realeaseType>.signing.properties` file:
4. Commit the changes. Message: "Version $versionName"
5. Run `./gradlew clean :app-k9mail:assembleRelease --no-build-cache --no-configuration-cache`
6. Update an existing installation to make sure the app is signed with the proper key and runs on a real device.
```
```shell
adb install -r app-k9mail/build/outputs/apk/release/app-k9mail-release.apk
```
7. Tag as $versionName, e.g. `6.508`
Expand Down Expand Up @@ -150,7 +150,7 @@ That way the new release won't contain any changes that weren't exposed to user
5. Commit the changes. Message: "Version $versionName"
6. Run `./gradlew clean :app-k9mail:assembleRelease --no-build-cache --no-configuration-cache`
7. Update an existing installation to make sure the app is signed with the proper key and runs on a real device.
```
```shell
adb install -r app-k9mail/build/outputs/apk/release/app-k9mail-release.apk
```
8. Tag as $versionName, e.g. `6.800`
Expand Down
26 changes: 18 additions & 8 deletions docs/SUMMARY.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,26 @@
# Summary

[Thunderbird for Android](README.md)

---

- [Contributing](CONTRIBUTING.md)
- [Design](DESIGN.md)
- [Releasing](RELEASING.md)
- [Translations](translations.md)
- [Java to Kotlin Conversion Guide](contributing/java-to-kotlin-conversion-guide.md)
- [Architecture Decision Records](architecture/adr/README.md)
- [0001 - Switch From Java to Kotlin](architecture/adr/0001-switch-from-java-to-kotlin.md)
- [0002 - UI - Wrap Material Components in Atomic Design System](architecture/adr/0002-ui-wrap-material-components-in-atomic-design-system.md)
- [0003 - Test - Switch Test Assertions From Truth to Assertk](architecture/adr/0003-switch-test-assertions-from-truth-to-assertk.md)
- [0004 - Naming Conventions for Interfaces and Their Implementations](architecture/adr/0004-naming-conventions-for-interfaces-and-their-implementations.md)
- [0005 - Central Project Configuration](architecture/adr/0005-central-project-configuration.md)
- [0006 - White Label Architecture](architecture/adr/0006-white-label-architecture.md)
- [0007 - Project Structure](architecture/adr/0007-project-structure.md)
- [Add Documentation](add-documentation.md)
- [Accepted]()
- [0001 - Switch From Java to Kotlin](architecture/adr/0001-switch-from-java-to-kotlin.md)
- [0002 - UI - Wrap Material Components in Atomic Design System](architecture/adr/0002-ui-wrap-material-components-in-atomic-design-system.md)
- [0003 - Test - Switch Test Assertions From Truth to Assertk](architecture/adr/0003-switch-test-assertions-from-truth-to-assertk.md)
- [0004 - Naming Conventions for Interfaces and Their Implementations](architecture/adr/0004-naming-conventions-for-interfaces-and-their-implementations.md)
- [0005 - Central Project Configuration](architecture/adr/0005-central-project-configuration.md)
- [0006 - White Label Architecture](architecture/adr/0006-white-label-architecture.md)
- [0007 - Project Structure](architecture/adr/0007-project-structure.md)
- [Proposed]()
- [Rejected]()

---

[How to Document](how-to-document.md)
76 changes: 0 additions & 76 deletions docs/add-documentation.md

This file was deleted.

2 changes: 1 addition & 1 deletion docs/architecture/adr/0007-project-structure.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# [Project Structure]
# Project Structure

- Issue: [#7852](https://github.com/thunderbird/thunderbird-android/issues/7852)
- Pull Request: [#7829](https://github.com/thunderbird/thunderbird-android/pull/7829)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion docs/assets/mermaid-init.js

This file was deleted.

1,648 changes: 0 additions & 1,648 deletions docs/assets/mermaid.min.js

This file was deleted.

6 changes: 6 additions & 0 deletions docs/assets/theme/last-changed.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
footer {
font-size: 0.8em;
text-align: center;
border-top: 1px solid var(--fg);
padding: 5px 0;
}
35 changes: 35 additions & 0 deletions docs/assets/theme/mermaid-init.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
(() => {
const darkThemes = ['ayu', 'navy', 'coal'];
const lightThemes = ['light', 'rust'];

const classList = document.getElementsByTagName('html')[0].classList;

let lastThemeWasLight = true;
for (const cssClass of classList) {
if (darkThemes.includes(cssClass)) {
lastThemeWasLight = false;
break;
}
}

const theme = lastThemeWasLight ? 'default' : 'dark';
mermaid.initialize({ startOnLoad: true, theme });

// Simplest way to make mermaid re-render the diagrams in the new theme is via refreshing the page

for (const darkTheme of darkThemes) {
document.getElementById(darkTheme).addEventListener('click', () => {
if (lastThemeWasLight) {
window.location.reload();
}
});
}

for (const lightTheme of lightThemes) {
document.getElementById(lightTheme).addEventListener('click', () => {
if (!lastThemeWasLight) {
window.location.reload();
}
});
}
})();
2,314 changes: 2,314 additions & 0 deletions docs/assets/theme/mermaid.min.js

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions docs/assets/theme/navigation.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.sidebar-scrollbox .section a[href*="adr"] strong {
display: none;
}

.sidebar-scrollbox .section a[href*="adr"] .number {
font-weight: 550;
}

.chapter li .chapter-item div {
display: block;
padding: 0;
text-decoration: none;
color: var(--sidebar-fg);
}
18 changes: 18 additions & 0 deletions docs/assets/theme/navigation.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
document.querySelectorAll('.sidebar-scrollbox .section a[href*="adr"]').forEach(el => {
let textNodes = [...el.childNodes].filter(node => node.nodeType === Node.TEXT_NODE && node.nodeValue.trim().length > 0);

if (textNodes.length > 0) {
let textNode = textNodes[0]; // First text node (ignoring elements like <strong>)
let text = textNode.nodeValue.trim();

if (text.length >= 4) {
let span = document.createElement("span");
span.classList.add("number");
span.textContent = text.substring(0, 4);

textNode.nodeValue = text.substring(4); // Remove first 4 chars from original text node

el.insertBefore(span, textNode); // Insert the styled first 4 characters before the rest
}
}
});
61 changes: 61 additions & 0 deletions docs/assets/theme/pagetoc.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
a[class^='pagetoc-H']:only-child {
display: none;
}

@media only screen and (max-width:1439px) {
.sidetoc {
display: none;
}
}

@media only screen and (min-width:1440px) {
main {
position: relative;
}
.sidetoc {
margin-left: auto;
margin-right: auto;
left: calc(100% + (var(--content-max-width))/4 - 140px);
position: absolute;
}
.pagetoc {
position: fixed;
width: 200px;
height: calc(100vh - var(--menu-bar-height) - 0.67em * 4);
overflow: auto;
}
.pagetoc a {
border-left: 1px solid var(--sidebar-bg);
color: var(--fg) !important;
display: block;
padding-bottom: 5px;
padding-top: 5px;
padding-left: 10px;
text-align: left;
text-decoration: none;
}
.pagetoc a:hover,
.pagetoc a.active {
background: var(--sidebar-bg);
color: var(--sidebar-fg) !important;
}
.pagetoc .active {
background: var(--sidebar-bg);
color: var(--sidebar-fg);
}
.pagetoc .pagetoc-H2 {
padding-left: 20px;
}
.pagetoc .pagetoc-H3 {
padding-left: 40px;
}
.pagetoc .pagetoc-H4 {
padding-left: 60px;
}
.pagetoc .pagetoc-H5 {
display: none;
}
.pagetoc .pagetoc-H6 {
display: none;
}
}
Loading

0 comments on commit 1201e33

Please sign in to comment.