diff options
author | Canop <cano.petrole@gmail.com> | 2024-07-06 21:33:40 +0200 |
---|---|---|
committer | Canop <cano.petrole@gmail.com> | 2024-07-06 21:33:40 +0200 |
commit | e15a8e91d7b12eed5a44736dba29505836b37d70 (patch) | |
tree | 2e21e84753172fc946cb722b8633f8efbb8f96d2 | |
parent | 849540b0c5d40db5bee802b27b0334859d89df37 (diff) |
web: document preview transformers configuration
-rw-r--r-- | website/docs/conf_file.md | 79 | ||||
-rw-r--r-- | website/docs/img/20240706-match-surrounding-0-0.png | bin | 0 -> 68307 bytes | |||
-rw-r--r-- | website/docs/img/20240706-match-surrounding-1-1.png | bin | 0 -> 94661 bytes | |||
-rw-r--r-- | website/docs/img/20240706-preview-json.png | bin | 0 -> 111572 bytes | |||
-rw-r--r-- | website/docs/img/20240706-preview-pdf.png | bin | 0 -> 424740 bytes |
5 files changed, 66 insertions, 13 deletions
diff --git a/website/docs/conf_file.md b/website/docs/conf_file.md index 339657c..eea35af 100644 --- a/website/docs/conf_file.md +++ b/website/docs/conf_file.md @@ -271,6 +271,72 @@ terminal_title: "{file} 🐄" terminal_title = "{file} 🐄" ``` +# Preview + +## Transformers + +It's possible to define transformers to apply to some files before preview. + +This makes it possible for example to render a specific kind of files as images, or to beautify some text ones. + +Below are two examples that you may adapt to your needs and prefered tools. + +### Render PDF using mutool: + +![preview pdf](img/20240706-preview-pdf.png) + +```Hjson +preview_transformers: [ + # Use mutool to render any PDF file as an image + # In this example we use placeholders for the input and output files + { + input_extensions: [ "pdf" ] // case doesn't matter + output_extension: png + mode: image + command: [ "mutool", "draw", "-o", "{output-path}", "{input-path}" ] + } +] +``` + +### Beautify JSON using jq + +![preview json](img/20240706-preview-json.png) + +```Hjson +preview_transformers: [ + # Use jq to beautify JSON + # In this example, the command refers to neither the input nor the output, + # so broot pipes them to the stdin and stdout of the jq process + { + input_extensions: [ "json" ] + output_extension: json + mode: text + command: [ "jq" ] + } +] +``` + +## Match surroundings + +You may limit the filtered view to just the matching lines: + +![0 line around match](img/20240706-match-surrounding-0-0.png) + +But if you want to have more than just the matching lines displayed in preview, you may set those parameters to + +```Hjson +lines_before_match_in_preview: 1 +lines_after_match_in_preview: 1 +``` +```TOML +lines_before_match_in_preview = 1 +lines_after_match_in_preview = 1 +``` + +And you'll get + +![1 line around match](img/20240706-match-surrounding-1-1.png) + # Miscellaneous ## Kitty Graphics @@ -388,16 +454,3 @@ show_matching_characters_on_path_searches = false which gives this: ![not shown](img/subpath-match-not-shown.png) - -## Lines surrounding a match in preview - -If you want to have more than just the matching lines displayed in preview, you may changes those parameters in config: - -```Hjson -lines_before_match_in_preview: 0 -lines_after_match_in_preview: 0 -``` -```TOML -lines_before_match_in_preview = 0 -lines_after_match_in_preview = 0 -``` diff --git a/website/docs/img/20240706-match-surrounding-0-0.png b/website/docs/img/20240706-match-surrounding-0-0.png Binary files differnew file mode 100644 index 0000000..76bf132 --- /dev/null +++ b/website/docs/img/20240706-match-surrounding-0-0.png diff --git a/website/docs/img/20240706-match-surrounding-1-1.png b/website/docs/img/20240706-match-surrounding-1-1.png Binary files differnew file mode 100644 index 0000000..4cc9c3b --- /dev/null +++ b/website/docs/img/20240706-match-surrounding-1-1.png diff --git a/website/docs/img/20240706-preview-json.png b/website/docs/img/20240706-preview-json.png Binary files differnew file mode 100644 index 0000000..8d81bf2 --- /dev/null +++ b/website/docs/img/20240706-preview-json.png diff --git a/website/docs/img/20240706-preview-pdf.png b/website/docs/img/20240706-preview-pdf.png Binary files differnew file mode 100644 index 0000000..b2e9d3d --- /dev/null +++ b/website/docs/img/20240706-preview-pdf.png |