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 ?
UPDATE: the correct answer to this particular question is following https://stackoverflow.com/a/28059832/462601 . Answer presented here is related to this question Syntax highlighting within #+begin_src block in emacs orgmode not working
You mean like syntax-highlighting source blocks in buffer?
#+BEGIN_SRC ruby
Array.new
#+END_SRC
You need to set (setq org-src-fontify-natively t)
Ref: http://orgmode.org/worg/org-contrib/babel/examples/fontify-src-code-blocks.html
(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.
)))
(defun org-fontify-inline-src-block (limit) "Fontify inline source block." (when (re-search-forward org-babel-inline-src-block-regexp limit t) (add-text-properties (match-beginning 1) (match-end 0) '(font-lock-fontified t face (t (:foreground "#008ED1" :background "#FFFFEA")))) (org-remove-flyspell-overlays-in (match-beginning 0) (match-end 0)) t))
add to function org-set-font-lock-defaults in org.el
;; Drawers '(org-fontify-drawers) ;; Inline source block '(org-fontify-inline-src-block)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With