enter image description here

it became to one long straight bar, instead of showing as a block of the paragraph. I use #+begin_example. if I use quote it looks ok but I want to have the block looks.


#+begin_example turns into <pre class="example">, and <pre> elements normally don't wrap. However, you can make them wrap with CSS. Add this somewhere to your document (I usually put this at the beginning):

#+begin_export html
    pre.example { white-space: pre-wrap; }

You might also try white-space: normal or white-space: pre-line. The default for <pre> elements is white-space: pre. There's a table of options and examples of how they look on MDN's reference page for white-space.

You can also apply this to src blocks by adding a rule pre.src { white-space: pre-wrap; }.

| improve this answer | |

Use Special Block Syntax

The special block is a type of Greater Block.

For example, when the special block below is exported to HTML the div tag will be assigned class="NAME" attribute.

Contents of special block.

Below are the results after the special block is exported to HTML.

<div class="NAME">
Contents of special block.


Hope that helped!

The code in this answer was tested using:
emacs version: GNU Emacs 25.2.1
org-mode version: 9.1.2

| improve this answer | |

#+BEGIN_EXAMPLE is intended to be unbroken, as far as I know. From the info page:

You can include literal examples that should not be subjected to markup. Such examples will be typeset in monospace, so this is well suited for source code and similar examples.

Probably the best way to handle this is to use a #+BEGIN_HTML block and style it manually. You could also insert line breaks manually in the EXAMPLE block, but I doubt you want to do that.

| improve this answer | |
  • Yeah...Manually use HTML is painful, so the best way is to use QUOTE? How about when I write some code inside of ` #+begin_src `, sometimes I have one long line of code or multiline of comment, how to solve this? – bagMan Oct 15 '16 at 3:16
  • As far as I know, in SRC blocks you'll have to do line breaks manually. fill-paragraph (M-q) can do that for you. Alternatively, maybe you could hook into the exporter to automatically run fill-paragraph on code blocks when exported, but that is a labyrinth I cannot help you with. :) – user3871 Oct 15 '16 at 12:56

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.