aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2025-04-07 21:02:03 +0200
committerLoek Le Blansch <loek@pipeframe.xyz>2025-04-07 21:02:03 +0200
commit0160f37f2a31c820c602f174d8f6431df077d10a (patch)
tree07912eeab927c8229d7944f895f9416da657fc1f
parent443de46f5ba410dbd71945399e52c677f02ed6af (diff)
add json to preview script
-rwxr-xr-x.local/share/bin/preview4
1 files changed, 4 insertions, 0 deletions
diff --git a/.local/share/bin/preview b/.local/share/bin/preview
index 2fe9c4d..141d03c 100755
--- a/.local/share/bin/preview
+++ b/.local/share/bin/preview
@@ -12,6 +12,7 @@ MIMETYPE="$(file --mime-type -Lb "$FILE")"
EXT="${FILE#*.}"
[ "$EXT" = "md" ] && [ "$MIMETYPE" = "text/plain" ] && MIMETYPE="application/markdown"
+[ "$MIMETYPE" = "application/javascript" ] && MIMETYPE="text/javascript"
render_manpage() {
exec groff -T utf8 -m man -rcR=1 -rIN=0 -rLL="${WIDTH}n" << EOF
@@ -49,6 +50,9 @@ case "$MIMETYPE" in
application/markdown)
pandoc --from=gfm --to=man "$FILE" | render_manpage
;;
+ application/json)
+ jq --color-output . "$FILE"
+ ;;
*)
echo "$MIMETYPE"
file -b "$FILE" | fold --width="$WIDTH" --spaces