feat: html rendering

This commit is contained in:
2026-03-12 14:52:29 +01:00
parent 60f763df19
commit eb8f4574bf
10 changed files with 191 additions and 93 deletions

33
src/sh/notmuch.sh Normal file
View File

@@ -0,0 +1,33 @@
# Wrapper around notmuch
# Print the message id of the last message within a thread.
# @argument $1: thread id
nm_last_message_in_thread() {
$NOTMUCH search --output=messages --offset=-1 thread:"$1" | sed 's/^...//'
}
# Print the header of a message (with trailing empty line)
# @argument $1: message id
nm_message_header() {
$NOTMUCH show --body=false id:"$1" | awk "$AWK_MESSAGEHEADER"
}
# Print the message parts (with indents)
# @argument $1: message id
nm_message_parts() {
$NOTMUCH show --body=true id:"$1" | awk "$AWK_MESSAGEPARTS"
}
# Print the message part number for text/plain or text/html
# @argument $1: message id
# @argument $2: if set, then the html part number will be printed
nm_message_part_nr() {
$NOTMUCH show --body=true id:"$1" | awk -v html="${2:-}" "$AWK_PARTNR"
}
# Print part of message
# @argument $1: message id
# @argument $2: part number
nm_message_get_part() {
$NOTMUCH show --part="$2" id:"$1"
}