Skip to content

Commit 2ebe878

Browse files
committed
docs(readme): collapse verbose sections into expandable details blocks
1 parent 8d7752b commit 2ebe878

1 file changed

Lines changed: 39 additions & 2 deletions

File tree

README.md

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,9 @@ snakefmt - < Snakefile
235235
236236
### Full Usage
237237
238+
<details>
239+
<summary>Show full help output</summary>
240+
238241
```
239242
$ snakefmt --help
240243
Usage: snakefmt [OPTIONS] [SRC]...
@@ -289,10 +292,15 @@ Options:
289292
-v, --verbose Turns on debug-level logger.
290293
```
291294
295+
</details>
296+
292297
### Directive Sorting
293298
294299
By default, `snakefmt` sorts rule and module directives (like `input`, `output`, `shell`, etc.) into a consistent order. This makes rules easier to read and allows for quicker cross-referencing between inputs, outputs, and the resources used by the execution command.
295300
301+
<details>
302+
<summary>Directive ordering details</summary>
303+
296304
Directives are grouped by their functional role in the following order:
297305
298306
1. **Identity & Early Control**: `name`, `default_target`
@@ -306,6 +314,8 @@ Directives are grouped by their functional role in the following order:
306314
307315
This ordering ensures that the directives most frequently used in execution blocks (like `threads`, `resources`, and `params`) are placed immediately above the action directive.
308316
317+
</details>
318+
309319
You can disable this feature using the `--no-sort` flag.
310320
311321
### Shell Block Formatting
@@ -369,6 +379,9 @@ format_shell = false
369379
370380
`shfmt` is invoked with `-i 4 -ci -bn` (four-space indentation, indented switch cases, binary operators may start a line).
371381
382+
<details>
383+
<summary>Advanced details: placeholders, heredocs, brace groups, invalid shell</summary>
384+
372385
#### Snakemake placeholders
373386
374387
Snakemake `{var}` placeholders are masked before `shfmt` runs so it does not mis-parse them, then restored verbatim afterwards.
@@ -422,6 +435,8 @@ To work around genuinely invalid shell, either:
422435
- Disable shell formatting for the whole run with `-F` / `--no-format-shell`, or
423436
- Wrap the rule in `# fmt: off` / `# fmt: on` directives (see below) to opt that block out.
424437
438+
</details>
439+
425440
### Format Directives
426441
427442
`snakefmt` supports comment directives to control formatting behaviour for specific regions of code.
@@ -454,6 +469,9 @@ rule c:
454469
455470
> **Note:** inside `run:` blocks and other Python contexts, `# fmt: off` / `# fmt: on` is passed through to [Black][black], which handles it natively.
456471
472+
<details>
473+
<summary>Additional directives: <code># fmt: off[sort]</code>, <code># fmt: off[next]</code>, <code># fmt: skip</code></summary>
474+
457475
#### `# fmt: off[sort]`
458476
459477
Disables directive sorting for the enclosed region while still applying all other formatting.
@@ -503,6 +521,8 @@ rule also_formatted:
503521
> **Note:** `# fmt: skip` is not yet supported within Snakemake rule blocks.
504522
> It currently applies only to plain Python lines outside of rules, checkpoints, and similar Snakemake constructs.
505523
524+
</details>
525+
506526
### Configuration
507527
508528
`snakefmt` is able to read project-specific default values for its command line options
@@ -566,7 +586,11 @@ Then [install pre-commit](https://pre-commit.com/#installation) and initialize t
566586
567587
[GitHub Actions](https://github.com/features/actions) in combination with [super-linter](https://github.com/github/super-linter) allows you to automatically run `snakefmt` on all Snakefiles in your repository e.g. whenever you push a new commit.
568588
569-
To do so, create the file `.github/workflows/linter.yml` in your repository:
589+
<details>
590+
<summary>Show GitHub Actions workflow configuration</summary>
591+
592+
Create `.github/workflows/linter.yml` in your repository:
593+
570594
```yaml
571595
---
572596
name: Lint
@@ -607,11 +631,14 @@ jobs:
607631
```
608632
609633
Additional configuration parameters can be specified by creating `.github/linters/.snakefmt.toml`:
634+
610635
```toml
611636
[tool.black]
612637
skip_string_normalization = true
613638
```
614639
640+
</details>
641+
615642
For more information check the `super-linter` readme.
616643
617644
## Plug Us
@@ -621,6 +648,9 @@ in your project.
621648
622649
[![Code style: snakefmt](https://img.shields.io/badge/code%20style-snakefmt-000000.svg)](https://github.com/snakemake/snakefmt)
623650
651+
<details>
652+
<summary>Copy badge markup</summary>
653+
624654
### Markdown
625655
626656
```md
@@ -634,6 +664,8 @@ in your project.
634664
:target: https://github.com/snakemake/snakefmt
635665
```
636666
667+
</details>
668+
637669
## Changes
638670
639671
See [`CHANGELOG.md`][changes].
@@ -646,7 +678,10 @@ See [CONTRIBUTING.md][contributing].
646678
647679
[![DOI][doi-shield]][doi]
648680
649-
```Bibtex
681+
<details>
682+
<summary>BibTeX</summary>
683+
684+
```bibtex
650685
@article{snakemake2021,
651686
doi = {10.12688/f1000research.29032.2},
652687
url = {https://doi.org/10.12688/f1000research.29032.2},
@@ -661,6 +696,8 @@ See [CONTRIBUTING.md][contributing].
661696
}
662697
```
663698
699+
</details>
700+
664701
665702
[snakemake]: https://snakemake.readthedocs.io/
666703
[black]: https://black.readthedocs.io/en/stable/

0 commit comments

Comments
 (0)