-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pager: fallback to syntect as syntax highligther #15
base: master
Are you sure you want to change the base?
Conversation
Fallback to use syntect library as syntax highlighter if no pager is defined in the meli config. Signed-off-by: Guillaume Ranquet <granquet@baylibre.com>
The theme and syntax are hardcoded for now. Just pushing this MR as a draft to gather some feedback? Using syntect as the syntax highlighter: https://github.com/trishume/syntect |
Hm wouldn't it make more sense to offload this to the pager filter command instead of shipping it in the binary? It follows the unix philosophy 'Make each program do one thing well' by design. |
Yes, the result would be similar to piping the mail content into Though I expect to be able to be a bit more intelligent about this if the coloring is done internally... I would like to have a mix of diff and mail coloring schemes depending on the paragraphs of the mail content and have a way to navigate between those paragraphs. |
This is reasonable! How about adding an option to pass more information To cover the broadest language support the serialization format could be The output going to the filter's stdin could be something like: {
"head": {
"headers": {
"header-name": ["header-value-1", .. ],
..
},
"other-metadata?": {
..
}
},
"body": [
{
"name": text or null or missing as key,
"filter": bool,
"content-type": ..,
"bytes": "bytes #0..",
},
{
"name": ..,
"filter": bool,
"content-type": ..,
"bytes": "bytes #1..",
},
..
]
} The client configuration option can be: [pager]
filter = "/path/to/myscript"
filter_options = "plain" #default, current behavior
filter_options = { "type" = "json", "extra_headers" = [ "List-ID" ], include_binary_attachments = false } Something like that. I want to avoid adding dependencies if it's not necessary because (a) it I'd really welcome such functionality as separate binaries, perhaps in |
I understand your point... but this sounds rather complex for something that should (for me) be part of the mail client by default. could it be added as a feature at compile time? would not change the default for everyone... but those interested could get the features built-in. |
A feature sounds good! We can merge it that way first and then do improvements on future commits/PRs. |
Hey @granquet, would it be okay for me to pick this up or would you like to work on this at your own time? No hurry, I just don't want your effort unused 🙃 |
Hi @epilys, no problem if you want to take over, I hadn't much time to keep working on these ideas. |
6ce5146
to
bb7e119
Compare
Fallback to use syntect library as syntax highlighter if no pager is defined in the meli config.
Signed-off-by: Guillaume Ranquet granquet@baylibre.com