2

I'm writing an org-mode document where I want to mark up only part of a single word; for example, I might want something like these examples, which were generated by the Markdown some*thing* like these `example`s. The analogous org-mode code, however, doesn't work:

some/thing/ like these ~example~s

syntax highlights/exports (or rather, doesn't) as

some/thing/ like these ~example~s

How can I get org-mode to produce the appropriate syntax highlighting/exported output, namely

some/thing/ like these ~example~s

? (Dropping the "/" and "~" in exported content, of course.)

1 Answers1

1

There is no way to do that. You can work around it for HTML export like this

Some@@html:<i>thing</i>@@ else

Edit: After further investigation, you should see this answer on StackOverflow.

jkiiski
  • 121
  • 2
  • Your edit is great, and gets almost all the way there, but there's one problem: org-mode appears to match certain emphasis groups greedily, leading to breakage when there's more than one emphasis group immediately followed by word text in the same paragraph. For instance, consider the following org-mode source: `/foo/ bar/baz/ quux /xyzzy/plugh fnord /thud/blat`. This appears in the buffer¹ as "*foo* bar*baz* quux *xyzzy/plugh fnord /thud*blat" – note that *all* the text from "xyzzy" through "thud" (including "fnord") is italicized. Any idea what to do about that? – Antal Spector-Zabusky Jan 20 '16 at 13:14
  • (¹ This is a bit of a lie – the previous comment should have "/"s in the buffer appearance around all the italicized bits, but – amusingly – I'm having trouble getting Markdown to render my sub-word formatting correctly!) – Antal Spector-Zabusky Jan 20 '16 at 13:18
  • For me it seems to work correctly. The string you gave exports to html as `foo barbaz quux xyzzyplugh fnord thudblat`. – jkiiski Jan 20 '16 at 13:27
  • Interesting: it *exports* correctly here too, but it's all wrong *in the buffer*, [as you can see from this screenshot](http://i.stack.imgur.com/DndGn.png). And that's what I'm more concerned about, since it's where I spend most of my time interacting with the document. – Antal Spector-Zabusky Jan 20 '16 at 13:32
  • You could try doing something like this `(setcar (nthcdr 3 org-emphasis-regexp-components) "[^/\n]")` before the `(org-set-emph-re ...`. The fourth element in `org-emphasis-regexp-components` defines allowed body characters. My knowledge of regexes is limited, but I think that one would forbid `/`, so it shouldn't match greedily anymore. Although as a drawback it wont allow slashes inside bold or code parts either. – jkiiski Jan 20 '16 at 14:02