Emacs org-mode - Export to html without syntax highlighting

admin

Administrator
Staff member
I'm using org-mode to write blog post(wordpress).
Because I'm using a plugin for syntax highlighting, I don't need to use org-mode's syntax highlighting.

Here is example.

Source in emacs.
<a href=" " rel="nofollow noreferrer"><img src=" " alt="enter image description here"></a>

Exported output.
<a href=" " rel="nofollow noreferrer"><img src=" " alt="enter image description here"></a>

When I remove language field followed
Code:
BEGIN_SRC
, syntax highlighting is also disapeared. But I just want to disable syntax highlighting only when exporting without removing language field(emacs-lisp).

Also I tested below, but it does not work.

Code:
(setq org-src-fontify-natively t)

<strong>============ UPDATE ============</strong>

I applied below. (Thanks @Picaud Vincent)
(setq org-html-htmlize-output-type 'nil)

It works fine with source block without language field. But It does not work with source block with language field.

here is example.

In .emacs file..
(setq org-html-htmlize-output-type 'nil)

<ol>
<li>without language field
origin</li>
</ol>

<div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override">
Code:
#+BEGIN_SRC
      (setq org-todo-keywords
            '((sequence "TODO" "FEEDBACK" "VERIFY" "|" "DONE" "DELEGATED")))
#+END_SRC
</div>
</div>


exported

<div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override">
Code:
&lt;pre class="example"&gt;
    (setq org-todo-keywords
          '((sequence "TODO" "FEEDBACK" "VERIFY" "|" "DONE" "DELEGATED")))
&lt;/pre&gt;
</div>
</div>


<ol start="2">
<li>with language field
origin</li>
</ol>

<div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override">
Code:
#+BEGIN_SRC emacs-lisp
      (setq org-todo-keywords
            '((sequence "TODO" "FEEDBACK" "VERIFY" "|" "DONE" "DELEGATED")))
#+END_SRC
</div>
</div>


exported

<div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override">
Code:
&lt;div class="org-src-container"&gt;

&lt;pre class="src src-emacs-lisp"&gt;&lt;/pre&gt;
</div>
</div>


<strong>============ UPDATE ============</strong>

Finally, I found solution.

<ol>
<li>Follow @Picaud Vincent' answer.
Code:
(setq org-html-htmlize-output-type
nil)`</li>
<li>If There is no code in source block with language field, add
Code:
exports: code
to language field.
ex>
Code:
#+BEGIN_SRC emacs-lisp:exports code
</li>
</ol>

Although adding 'exports: code` disables syntax highlighting in org-mode buffer, but it solve my problem.