Hello everyone, I have noticed that it is not possible to combine org-emphasis-alist characters. When applying multiple types of emphasis, the face corresponding to the outermost pair overrides its innermost counterparts. For example, */emphasise/* will render with the 'bold' face, while /*emphasise*/ will use the 'italic' face. Looking at the code, this seems to be intentional or unavoidable, while I do not know of a way to blend faces dynamically. Is there a way to get composite styles? Such as bold and italic or verbatim and underline, etc.? All the best, Protesilaos (or simply "Prot") * * * M-x org-version: Org mode version 9.4.4 (release_9.4.4 @ /usr/share/emacs/28.0.50/lisp/org/) M-x emacs-version: GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.30, cairo version 1.17.4) of 2021-09-28 -- Protesilaos Stavrou https://protesilaos.com
Hi Protesilaos,
Protesilaos Stavrou writes:
> Is there a way to get composite styles? Such as bold and italic or
> verbatim and underline, etc.?
A somewhat dirty solution (without patching the code) could be
evaluating highlight-regexp, for example as a local variable:
#+begin_src emacs-lisp
(defface my/org-it-bold
'((t :slant italic :bold t))
"")
(highlight-regexp "\\([-[:space:]('\"{]\\|^\\)\\(\\([*/_+]\\)\\([*/_+]\\)\\([^[:space:]]\\|[^[:space:]].*?\\(?:
.*?\\)\\{0,15\\}[^[:space:]]\\)\\3\\)\\([-[:space:].,:!?;'\")}\\[]\\|$\\)" 'my/org-it-bold)
#+end_src
Best regards,
Juan Manuel
Protesilaos Stavrou <info@protesilaos.com> writes: > Hello everyone, > > I have noticed that it is not possible to combine org-emphasis-alist > characters. When applying multiple types of emphasis, the face > corresponding to the outermost pair overrides its innermost counterparts. > > For example, */emphasise/* will render with the 'bold' face, while > /*emphasise*/ will use the 'italic' face. Confirmed > Looking at the code, this seems to be intentional or unavoidable, while > I do not know of a way to blend faces dynamically. > > Is there a way to get composite styles? Such as bold and italic or > verbatim and underline, etc.? org-element-context does return nested emphasis, so it is certainly possible to combine composite styles (at least, during export). Fontification code does not work with elements though and I do not see an easy way to change it. Rewriting fontification using org-element API would eliminate this type of issues. However, I am not sure about performance (maybe with org-element-cache?). Best, Ihor