Skip to content
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

Clean up the generated CLI reference and remove the need fo a symlink using the include-markdown plugin #2986

Merged
merged 4 commits into from
Feb 12, 2024
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
7 changes: 1 addition & 6 deletions cli/tests/cli-reference@.md.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,7 @@ source: cli/tests/test_generate_md_cli_help.rs
description: "AUTO-GENERATED FILE, DO NOT EDIT. This cli reference is generated as an `insta` snapshot. MkDocs follows they symlink from docs/cli-reference.md to the snap. Unfortunately, `insta` unavoidably creates this header. Luckily, MkDocs ignores the header since it has the same format as Markdown headers. TODO: MkDocs may fail on Windows if symlinks are not enabled in the OS settings"
---

!!! warning

This CLI reference is experimental. It is automatically generated, but
does not match the `jj help` output exactly.

<!-- See also https://github.com/ConnorGray/clap-markdown/issues -->
<!-- BEGIN MARKDOWN-->

# Command-Line Help for `jj`

Expand Down
7 changes: 1 addition & 6 deletions cli/tests/test_generate_md_cli_help.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,7 @@ use insta::assert_snapshot;
use crate::common::TestEnvironment;

const PREAMBLE: &str = r#"
!!! warning

This CLI reference is experimental. It is automatically generated, but
does not match the `jj help` output exactly.

<!-- See also https://github.com/ConnorGray/clap-markdown/issues -->
<!-- BEGIN MARKDOWN-->

"#;

Expand Down
1 change: 0 additions & 1 deletion docs/cli-reference.md

This file was deleted.

19 changes: 19 additions & 0 deletions docs/cli-reference.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!-- The contents of the CLI reference is auto-generated by a Rust test.
--- If `cargo insta` is installed, you can regenerate the CLI reference with:
--- cargo insta test --accept --workspace -- test_generate
-->

!!! warning

This CLI reference is experimental. It is automatically generated, but
does not match the `jj help` output exactly.

<!-- See also https://github.com/ConnorGray/clap-markdown/issues -->


{%
include-markdown "../cli/tests/cli-reference@.md.snap"
rewrite-relative-urls=false
start="<!-- BEGIN MARKDOWN-->"
%}

8 changes: 8 additions & 0 deletions mkdocs-offline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@
INHERIT: 'mkdocs.yml'
plugins:
- offline

# For now, *every plugin config* from `mkdocs.yml` has to be repeated here.
# https://github.com/mondeja/mkdocs-include-markdown-plugin/issues/195#issuecomment-1933085478
# https://github.com/mkdocs/mkdocs/issues/3216
- include-markdown # For the CLI reference
- search
- redirects:
redirect_maps:
# Turns out the `offline` plugin forces the following
# option no matter what, and therefore shouldn't be
# used in the main config file.
Expand Down
4 changes: 4 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ theme:
extra:
version:
provider: mike

# IMPORTANT: any changes to plugins have to be duplicated in
# `mkdocs-offline.yml`. See that file for more details.
plugins:
- include-markdown # For the CLI reference
- search
- redirects:
redirect_maps:
Expand Down
272 changes: 159 additions & 113 deletions poetry.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ mdx-breakless-lists = "^1.0.1"
mkdocs-redirects = "^1.2.1"
# Versioning of documentation
mike = "^2.0.0"
mkdocs-include-markdown-plugin = "^6.0.4"

[build-system]
requires = ["poetry-core>=1.0.0"]
Expand Down