emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Inline code syntax highlighting


From: Nicolas Goaziou
Subject: Re: [O] Inline code syntax highlighting
Date: Mon, 22 Feb 2016 09:32:49 +0100

Hello,

address@hidden writes:

> In conclusion, do you have any tips on how to get syntax highlighting
> for ~...~ blocks?

You can use `org-export-filter-parse-tree' and replace all occurrences
of (code ...) into (inline-src-block ...) using a combination of
`org-element-map', and `org-element-set-element'.

Another option is indeed to create a new export back-end that replaces
code transcoder with a custom function, probably something ultimately
calling `org-html-inline-src-block', e.g.,

  (defun my-code-to-haskell (code contents info)
    (let ((haskell
           `(inline-src-block
             (:language "haskell" :value ,(org-element-property :value code)))))
      (org-html-inline-src-block haskell nil info)))

  (org-export-define-derived-backend 'haskell-html 'html
    :translate-alist '((code . my-code-to-haskell)))


Regards,

-- 
Nicolas Goaziou



reply via email to

[Prev in Thread] Current Thread [Next in Thread]