emacssyntaxsyntax-highlightinghighlightorg-mode

How to syntax highlight for Org-mode inline source code src_lang{}?


Is there a way to syntax highlight Org-mode inline source code which is marked with src_ruby{Array.new} ?

Does Org-mode has default option for this ? Or Is there other method to do this ?


Solution

  • enter image description here

    (font-lock-add-keywords 'org-mode
                        '(("\\(src_\\)\\([^[{]+\\)\\(\\[:.*\\]\\){\\([^}]*\\)}"
                           (1 '(:foreground "black" :weight 'normal :height 10)) ; src_ part
                           (2 '(:foreground "cyan" :weight 'bold :height 75 :underline "red")) ; "lang" part.
                           (3 '(:foreground "#555555" :height 70)) ; [:header arguments] part.
                           (4 'org-code) ; "code..." part.
                           )))