jeremy-compostella / org-msg

OrgMsg is a GNU/Emacs global minor mode mixing up Org mode and Message mode to compose and reply to emails in a Outlook HTML friendly style.
GNU General Public License v3.0
280 stars 60 forks source link

Attaching attributes to the ‘body’ element #68

Closed oatmealm closed 3 years ago

oatmealm commented 4 years ago

Is it possible to manipulate the body element and add attributes? Id like to experiment with dir=auto and other css properties for mixed script mail, English, Hebrew and Arabic.

jeremy-compostella commented 4 years ago

You can use css for this Below is an example modification I did in my org-msg.el org-msg-default-style variable.

@@ -225,6 +225,7 @@ Example:
         (margin-top . "0px") (margin-left . "30px")
         (padding-top . "0px") (padding-left . "5px")))
     (nil signature (,@font (margin-bottom . "20px")))
+    (nil right_to_left (,@font (margin-bottom . "20px") (direction . "rtl")))
     (blockquote nil ((padding-left . "5px") (margin-left . "10px")
             (margin-top . "20px") (margin-bottom . "0")
             (border-left . "3px solid #ccc") (font-style . "italic")

Then I re-evaluate org-msg-default-style and org-msg-enforce-css.

Then the following example worked for me:

#+OPTIONS: html-postamble:nil H:5 num:nil ^:{} toc:nil author:nil email:nil \n:t d:nil
#+STARTUP: hidestars indent inlineimages
:PROPERTIES:
:reply-to: nil
:attachment: nil
:END:

Hi,

#+begin_right_to_left
This text is right to left
#+end_right_to_left

This text is default left to right

Regards,

#+begin_signature
-- *Jeremy* \\
/One Emacs to rule them all/
#+end_signature
oatmealm commented 4 years ago

Thanks a lot! Much appreciated.

I was hopping to simply set a default which will apply to messages I compose, since typically you would want the message to be in a particular language, though sometimes mix in English in my example. For example, it could respect a #+LANGUAGE property in the header...?

jeremy-compostella commented 3 years ago

This has nothing to do with org-msg but you can add the following at the beginning of your buffer:

#+HTML: <style> body {direction: rtl} </style>

Alternatively you can modify the org-msg-default-style variable to include such a default style.