4

I have several strings in my org file, which look like as follows:

  1. something
  2. something else

When I org-export this file to html, these strings are automatically converted to lists, starting with 1. How to prevent that and export literal strings? Better with some specific #+OPTION or something like that. And how to disable offsets and padding for such strings?

  • It's not only html. That's org mode syntax for lists, probably from org-item-re. Sometimes I can't find ways to escape the org mode syntax :( but maybe you can mess with org-plain-list-ordered-item-terminator if you don't use lists anywhere else in the file. – amitp Jan 5 '17 at 0:06
  • Is it possible to change org-plain-list-ordered-item-terminator just for one particulat file? – Lev Lamberov Jan 5 '17 at 7:23
  • 1
    Ah, as suggested here inserting a non-breaking space after number and a dot works fine. It can be done with C-x 8 SPC. But it is also dirty thing. Would be better to customize org-plain-list-ordered-item-terminator in #+STARTUP or in #+OPTIONS. – Lev Lamberov Jan 5 '17 at 7:51
2

To export literal text you'll need to use the literal example syntax.

e.g.

  • Original text

    5. something
    6. something else
    
  • Literal Example

    #+BEGIN_EXAMPLE
     5. something
     6. something else
    #+END_EXAMPLE
    

    Exports to HTML as PRE tags

        <pre class="example">
        5. something
        6. something else
        </pre>
    

An Alternative solution using org entities and replace-regexp

e.g.

  • Original text

    5. something
    6. something else
    
  • Entities Example

    \nbsp5. something
    \nbsp6. something else
    

    Exports to HTML as &nbsp;

    &nbsp;5. something
    &nbsp;6. something else
    

    I used following command to do the search & replace:

    M-xreplace-regexpRET([0-9]+. )\nbsp\1RET


Tested using

GNU Emacs 24.5.1 (x86_64-unknown-cygwin, GTK+ Version 3.14.13)
org-mode: 9.0

  • Except you now get the formatting for examples. You could trick the CSS to change it, but you can't do that if you also want to use real examples. – JeanPierre Jan 5 '17 at 10:29
  • @JeanPierre - Good point!! I'll update my answer to include a workaround that doesn't export as pre tags but uses org entities instead. – Melioratus Jan 5 '17 at 18:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.