Let's us suppose I want to create a file (using emacs) to explain something about programming. For example, a mylib-tutorial.txt.
Is there a way to turn on syntax highlight on specific parts of a file containing code?
For example:
Tutorial
---------
This call behaves as follow:
void foo(&resource);
This call will provoke a huge stack overflow and all of your
personal files will be permanent lost (a copy to the police
will be sent, though).
Is there is a way to turn on syntax highlight for the code sample? Org-mode perhaps?
Enable org-src-fontify-natively:
(eval-after-load "org"
'(setq org-src-fontify-natively t))
And then use org-mode:
* Tutorial
This call behaves as follows:
#+BEGIN_SRC c
void foo(&resource);
#+END_SRC
This call will provoke a huge stack overflow and all of your
personal files will be permanent lost (a copy to the police
will be sent, though).
You can also edit the SRC block in c-mode using org-edit-special, bound to C-c ' by default. Use C-c ' again to close the c-mode buffer and update the Org buffer.
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