summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCanop <cano.petrole@gmail.com>2024-07-06 21:33:40 +0200
committerCanop <cano.petrole@gmail.com>2024-07-06 21:33:40 +0200
commite15a8e91d7b12eed5a44736dba29505836b37d70 (patch)
tree2e21e84753172fc946cb722b8633f8efbb8f96d2
parent849540b0c5d40db5bee802b27b0334859d89df37 (diff)
web: document preview transformers configuration
-rw-r--r--website/docs/conf_file.md79
-rw-r--r--website/docs/img/20240706-match-surrounding-0-0.pngbin0 -> 68307 bytes
-rw-r--r--website/docs/img/20240706-match-surrounding-1-1.pngbin0 -> 94661 bytes
-rw-r--r--website/docs/img/20240706-preview-json.pngbin0 -> 111572 bytes
-rw-r--r--website/docs/img/20240706-preview-pdf.pngbin0 -> 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
new file mode 100644
index 0000000..76bf132
--- /dev/null
+++ b/website/docs/img/20240706-match-surrounding-0-0.png
Binary files differ
diff --git a/website/docs/img/20240706-match-surrounding-1-1.png b/website/docs/img/20240706-match-surrounding-1-1.png
new file mode 100644
index 0000000..4cc9c3b
--- /dev/null
+++ b/website/docs/img/20240706-match-surrounding-1-1.png
Binary files differ
diff --git a/website/docs/img/20240706-preview-json.png b/website/docs/img/20240706-preview-json.png
new file mode 100644
index 0000000..8d81bf2
--- /dev/null
+++ b/website/docs/img/20240706-preview-json.png
Binary files differ
diff --git a/website/docs/img/20240706-preview-pdf.png b/website/docs/img/20240706-preview-pdf.png
new file mode 100644
index 0000000..b2e9d3d
--- /dev/null
+++ b/website/docs/img/20240706-preview-pdf.png
Binary files differ