1
1
mirror of https://github.com/wez/wezterm.git synced 2024-07-14 17:40:26 +03:00

docs: adopt mermaid-js for flowchart

This is a bit more compact and easier to edit.

A downside is that the search engine highlight can break the diagram and
cause it to emit a syntax error.
This commit is contained in:
Wez Furlong 2022-04-03 22:09:17 -07:00
parent e76525b695
commit 2a8ff9ca75
7 changed files with 34 additions and 35 deletions

View File

@ -29,12 +29,13 @@ jobs:
uses: actions/cache@v1
with:
path: ~/mdbook-bin
key: cargo-bin-mdbook-1
key: cargo-bin-mdbook-2
- name: Install mdBook
run: |
mkdir -p ~/mdbook-bin
(test -x ~/mdbook-bin/mdbook || (cd && cargo install --vers "^0.4" mdbook && cp -p ~/.cargo/bin/mdbook ~/mdbook-bin))
(test -x ~/mdbook-bin/mdbook-linkcheck || (cd && cargo install mdbook-linkcheck && cp -p ~/.cargo/bin/mdbook-linkcheck ~/mdbook-bin))
(test -x ~/mdbook-bin/mdbook-mermaid || (cd && cargo install mdbook-mermaid && cp -p ~/.cargo/bin/mdbook-mermaid ~/mdbook-bin))
- name: Build
run: |
source $HOME/.cargo/env

View File

@ -27,12 +27,13 @@ jobs:
uses: actions/cache@v1
with:
path: ~/mdbook-bin
key: cargo-bin-mdbook-1
key: cargo-bin-mdbook-2
- name: Install mdBook
run: |
mkdir -p ~/mdbook-bin
(test -x ~/mdbook-bin/mdbook || (cd && cargo install --vers "^0.4" mdbook && cp -p ~/.cargo/bin/mdbook ~/mdbook-bin))
(test -x ~/mdbook-bin/mdbook-linkcheck || (cd && cargo install mdbook-linkcheck && cp -p ~/.cargo/bin/mdbook-linkcheck ~/mdbook-bin))
(test -x ~/mdbook-bin/mdbook-mermaid || (cd && cargo install mdbook-mermaid && cp -p ~/.cargo/bin/mdbook-mermaid ~/mdbook-bin))
- name: Build
run: |
source $HOME/.cargo/env

1
.gitignore vendored
View File

@ -18,6 +18,7 @@
/docs/config/lua/mux-events/index.md
/docs/config/lua/window-events/index.md
/docs/config/lua/keyassignment/index.md
/docs/mermaid.min.js
**/*.rs.bk
.*.sw*
/esctest.log

View File

@ -5,6 +5,7 @@ set -x
[[ -f /tmp/wezterm.nightly.json ]] || curl https://api.github.com/repos/wez/wezterm/releases/tags/nightly > /tmp/wezterm.nightly.json
python3 ci/subst-release-info.py || exit 1
python3 ci/generate-docs.py || exit 1
mdbook-mermaid install docs
mdbook build docs
rm gh_pages/html/README.markdown

View File

@ -12,6 +12,7 @@ additional-css = ["custom.css"]
default-theme = "ayu"
preferred-dark-theme = "ayu"
git-repository-url = "https://github.com/wez/wezterm"
additional-js = ["mermaid.min.js", "mermaid-init.js"]
[output.html.fold]
enable = true
@ -19,3 +20,8 @@ level = 1
[output.linkcheck]
traverse-parent-directories = false
[preprocessor]
[preprocessor.mermaid]
command = "mdbook-mermaid"

View File

@ -17,39 +17,24 @@ local Pane. If no `cwd` can be resolved, then the `default_cwd` will be used.
If `default_cwd` is not specified, then the home directory of the user will be
used.
```text
Is initial window?
______________________|______________________
| |
Yes No
| |
Opened with CLI New pane, tab, or window. Opened with a
and `--cwd` flag? `SpawnCommand` that includes `cwd`?
__________|__________ __________|__________
| | | |
Yes No No Yes
| | | |
Use | Is there a value Use `cwd` specified
`--cwd` | set by OSC 7? by `SpawnCommand`
__________| __________|__________
| | |
| No Yes
| | |
| Can `cwd` be resolved via Use OSC 7
| the process group leader? value
| __________|__________
| | |
| No Yes
|____________| |
| Use resolved
Is `default_cwd` `cwd`
defined?
__________|__________
| |
Yes No
| |
Use Use home
`default_cwd` directory
```mermaid
graph TD
%%{wrap}%%
X[Determine current working directory for new pane] --> A{{Is initial window?}}
A -->|Yes| B[Opened with CLI and --cwd flag?]
A -->|No| C[New pane, tab or window.]
C --> D{{Opened with a SpawnCommand<br/> that includes cwd?}}
D -->|No| J{{Is there a value set by OSC 7?}}
B -->|Yes| E[Use --cwd]
B -->|No| F{{Is default_cwd defined?}}
F -->|Yes| G[Use default_cwd]
F -->|No| H[Use home directory]
D -->|Yes| I[Use cwd specified<br/> by `SpawnCommand`]
J -->|Yes| K[Use the OSC 7 value]
J -->|No| L{{Can cwd be resolved via<br/> the process group leader?}}
L -->|Yes| M[Use resolved cwd]
L -->|No| F
```
On macOS and Linux, `wezterm` can attempt to resolve the process group leader

4
docs/mermaid-init.js Normal file
View File

@ -0,0 +1,4 @@
mermaid.initialize({
startOnLoad:true,
theme:"dark",
});