Pages
  • one.el
  • Install one.el
  • Getting started
  • How does one.el work?
  • one-default render function
  • Miscellaneous
  • one-ox
  • one-ox | headline
  • one-ox | src-block
  • one-ox | quote-block
  • one-ox | fixed-width and example-block
  • one-ox | links
  • one-ox | plain-list and item
one.el
  • one.el
  • Install one.el
  • Getting started
  • How does one.el work?
  • one-default render function
  • Miscellaneous
  • one-ox
  • one-ox | headline
  • one-ox | src-block
  • one-ox | quote-block
  • one-ox | fixed-width and example-block
  • one-ox | links
  • one-ox | plain-list and item

one-ox | fixed-width and example-block

Table of content
  • Description
  • Example

Description

A line starting with a colon : followed by a space defines a fixed-width element. A fixed-width element can span several lines.

Blocks defined with #+BEGIN_EXAMPLE ... #+END_EXAMPLE pattern are example-block elements.

Both fixed-width and example-block blocks are treated as src-block in text-mode. So:

  1. they are highlighted as text-mode would do,

  2. they are exported in <pre><code>...</code></pre> components (indentation and newlines are respected) and

  3. the CSS classes used depend on the block's type:

    • normal blocks use one-hl one-hl-block CSS classes and

    • result blocks use one-hl one-hl-results CSS classes (see org keyword RESULTS).

Example

The following org snippet

Here is a ~fixed-width~ element (one line):

: I'm a fixed-width element

~fixed-width~ elements can also be used within lists:

- item 1

  : fixed-width element

- item 2

  #+BEGIN_SRC bash :results output
  printf 'multiline fixed-width element\nthat is also a result block,\nso has a different style.'
  #+END_SRC

  #+RESULTS:
  : multiline fixed-width element
  : that is also a result block,
  : so has a different style.

Although I don't often use ~example-block~ elements, here is one:

#+BEGIN_EXAMPLE
This    is
        an    example!
#+END_EXAMPLE

is exported by one as follow

<p>Here is a <code class="one-hl one-hl-inline">fixed-width</code> element (one line):
</p>

<pre><code class="one-hl one-hl-block">I'm a fixed-width element</code></pre>


<p><code class="one-hl one-hl-inline">fixed-width</code> elements can also be used within lists:
</p>

<ul><li><p>item 1
</p>

<pre><code class="one-hl one-hl-block">fixed-width element</code></pre>
</li>

<li><p>item 2
</p>

<pre><code class="one-hl one-hl-block"><span class="one-hl-builtin">printf</span> <span class="one-hl-string">'multiline fixed-width element\nthat is also a result block,\nso has a different style.'</span></code></pre>

<pre><code class="one-hl one-hl-results">multiline fixed-width element
that is also a result block,
so has a different style.</code></pre>
</li>
</ul>

<p>Although I don&apos;t often use <code class="one-hl one-hl-inline">example-block</code> elements, here is one:
</p>

<pre><code class="one-hl one-hl-block">This    is
        an    example!</code></pre>

and looks like this:

Here is a fixed-width element (one line):

I'm a fixed-width element

fixed-width elements can also be used within lists:

  • item 1

    fixed-width element
  • item 2

    printf 'multiline fixed-width element\nthat is also a result block,\nso has a different style.'
    multiline fixed-width element
    that is also a result block,
    so has a different style.

Although I don't often use example-block elements, here is one:

This    is
        an    example!
PREVRANDOMNEXT