Skip to content
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

Proper way to inject css #174

Open
pseudomyne opened this issue Sep 22, 2023 · 1 comment
Open

Proper way to inject css #174

pseudomyne opened this issue Sep 22, 2023 · 1 comment

Comments

@pseudomyne
Copy link

Hi,
I fail to inject some css in my emails.

I have (setq org-msg-enforce-css org-msg-default-style)
Preview is formated correctly (C-c C-e), but once sent to gmail, it won’t render as such.

I have tried to play with some org export options like org-html-head-include-default-style t / nil and org-html-html5-fancy t / nil with no result.

I also tried to inject external css with #+HTML_HEAD: <link rel="stylesheet" type="text/css" href="/home/me/style.css"/>,
Again it's ok within the preview, but won’t be sent through mail.
What options do I miss here ?

@mclearc : would you mind sharing your (whole) config options ?

@WillForan
Copy link

As far as I know, email clients can't/won't use <link> for styling, and I think even file-local <style> is ignored by some if not most. org-msg uses the style property list defined in org-msg-default-style to inline styles in every html element that needs them (like <pre style="background:black">). (org-msg-default-style use your current emacs theme to set colors!)

You can modify org-msg-default-style but that's an uphill battle with an additional maintenance burden. Alternatively, org-msg-enforce-css can be set to a css file (that will be read in by org-msg, converted to the same structure as org-mgs-default-style, and then inlined for each matching html element to be stylized). I'm working on a function that can create a suitable css from the defaults that you could then modify

Here's an example with the zerodark theme active with small modification to add a border to pre blocks: org-msg.css.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants