Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I escape slash in org-mode?

Tags:

emacs

org-mode

Take foo /bar/ baz as example, when exported to HTML, it becomes foo <i>bar</i> baz, now I want to export it with the original style foo /bar/ baz, how to achieve this ? I have tried foo \/bar\/ baz, but the output becomes foo \/bar\/ baz.

I know this is an easy question, I have googled a lot, but only find this one: Escape pipe-character in org-mode, the answer says slash escaping works fine, but for me, it seems not fine.


edit:

After searching org mode mailing list, I find a discussion and solution here: http://thread.gmane.org/gmane.emacs.orgmode/50743

There are two ways to do this:

  1. set option #+OPTIONS: *:nil to turn off all emphasis symbols
  2. modify variable org-emphasis-alist, remove relevant content

For me, the first solution is acceptable, and also it is simple.

like image 521
Kelvin Hu Avatar asked Mar 10 '13 16:03

Kelvin Hu


People also ask

How do you get out of the slash character?

The backslash character ( \ ) is the escaping character. It can be used to denote an escaped character, a string, literal, or one of the set of supported special characters. Use a double backslash ( \\ ) to denote an escaped string literal.

What can Org mode do?

Description. Org mode is routinely used to build and manage complex workflows. It does this using an elegantly simple syntax that scales from basic markup to full LaTeX typesetting and from plain text notes to literate programs. Everything you need to get started is demonstrated in the example.

How do I get into Org mode?

To enable Org mode on your current document, type M-x org-mode which will enable the Org mode on the current document. Those are minuses, not underscores. MY PROJECT is the title of the document, this can be anything. This will enable Org mode for this document, no matter what the file-ending is.


1 Answers

Put a zero-width space (U+200B; insert in Emacs using Ctrl-x 8 RET 200B RET) between the whitespace and the forward slash.

org-mode text

What do we see?
- /foo/
- ​/foo/

with a zero-width space inserted just before the first forward slash on the second "foo" line (not visible, because it has zero width) yields the following HTML after exporting:

<div id="content">
<h1 class="title">What do we see?</h1>

<ul>
<li><i>foo</i>
</li>
<li>​/foo/
</li>
</ul>

</div>

The zero-width space is exported, too, and ends up between the <li> and the /foo/ where you'd expect it.

like image 175
Louis Strous Avatar answered Sep 21 '22 13:09

Louis Strous