52

How do I specify a quote in org-mode so that it is rendered nicely in github? In markdown it is rendered like so:

Two things are infinite: the universe and human stupidity; and I'm not sure about the universe.

  • albert enstein

thanks in advance.

2 Answers 2

65

When quoting a passage from another document, it is customary to format this as a paragraph that is indented on both the left and the right margin. You can include quotations in Org mode documents like this:

 #+BEGIN_QUOTE
 Everything should be made as simple as possible,
 but not any simpler -- Albert Einstein
 #+END_QUOTE

This information in available in the org manual

When you convert your file to html then your text will be as shown below

enter image description here

7
  • 43
    You can insert #+BEGIN_QUOTE and #+END_QUOTE lines quickly by typing <q and then pressing TAB.
    – user12563
    Commented Oct 6, 2016 at 15:18
  • 2
    Is there a way to actually add formatting options to the quote in orgmode? E.g. #+BEGIN_QUOTE -gray_background -blue_margin ...? Just a silly example, but I'd like to get nice formatting like the OP's.
    – n1k31t4
    Commented Jun 27, 2018 at 19:02
  • 18
    Newer versions of Org-mode do not have <q TAB, but rather C-c C-, q (and its ilk). Commented Sep 8, 2019 at 23:00
  • 9
    @FernandoBasso you can still have <q TAB shortcut - you need to enable the org-tempo sub-module to have these structure template shorthands orgmode.org/manual/Structure-Templates.html Commented Apr 22, 2020 at 14:36
  • 1
    (Thank you @FernandoBasso, I noticed that <q had stopped working and was bereft!) Commented May 12, 2021 at 16:36
14

If you want to get nice formatting, you can customize the CSS of blockquote element.

Why blockquote element? If you use browser's inspect function to inspect the quote block, you can find its style is controlled by blockquote element.

Below is an example of StackExchange like quote block, you can find the configuration by using inspect function.

#+BEGIN_EXPORT html
<style>
blockquote {
    margin-bottom: 10px;
    padding: 10px;
    background-color: #FFF8DC;
    border-left: 2px solid #ffeb8e;
    border-left-color: rgb(255, 228, 102);
    display: block;
    margin-block-start: 1em;
    margin-block-end: 1em;
    margin-inline-start: 40px;
    margin-inline-end: 40px;
}
</style>
#+END_EXPORT

#+BEGIN_QUOTE
Everything should be made as simple as possible,

but not any simpler -- Albert Einstein
#+END_QUOTE

It renders like

enter image description here

In addition to writing css yourself, you can use alhassy/org-special-block-extras which offers a number of new custom blocks and link types.

3
  • 1
    should #+BEGIN_EXPORT html... added top of the file?
    – alper
    Commented May 11, 2023 at 9:53
  • @alper I think any place in the file is ok.
    – Ynjxsjmh
    Commented May 11, 2023 at 11:06
  • @n1k31t4 were you looking for this solution? Asking you based on the comment you made to the above answer
    – Prasanna
    Commented Apr 1 at 14:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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