Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to include a code block containing XML in org mode exports?

Tags:

emacs

org-mode

I have some XML inside an org mode file, and when export it to HTML, it's urgent display, so I an thinking of code block, such as

#+BEGIN_SRC java

#+END_SRC

But there is no XML support. What's the normal way to include XML in org mode?

like image 252
Daniel Wu Avatar asked Dec 20 '14 03:12

Daniel Wu


People also ask

How do you save in Org mode?

To save the document, either press the save icon, or press C-x C-s, call it 1.org.

What are Org mode files?

Org-mode (also: Org mode; /ˈɔːrɡ moʊd/) is a document editing, formatting, and organizing mode, designed for notes, planning, and authoring within the free software text editor Emacs.


1 Answers

I wonder if you've gotten confused by this list of supported languages, which does not include XML.

This list is the languages supported by Babel, which lets code snippets be executed from Org. Since XML is a markup language and not a programming language, it is not surprising that it is not included.

As far as I know, source code blocks can be in any language that you wish. The following works just fine for me:

#+BEGIN_SRC nxml
<test>
</test>
#+END_SRC

When point is in this block, C-c ' opens up the code block in a dedicated nxml-mode buffer, where the content can be edited at will. C-c ' closes this temporary buffer and updates my Org file.

Exported HTML includes this code block.

like image 102
Chris Avatar answered Nov 15 '22 09:11

Chris