rss_feed

# Org Markup Quick Reference

home Home
pages orgmode
pages markup

## Document headings

At the top of your document you place document meta data like titles author date etc these start #+ KEYWORD followed by a : and your text.

> :#+TITLE: Document title

Titles are marked with at the beginning of a line, would be a sub headers and is a sub sub heading.

> * Heading 1 level 1
> ** Sub Heading 1 level 2
> *** Sub Sub Heading 1 level 3
> * Heading 2 level 1

### Text Emphasis

You can make text underlined, italic bold and other styles using the characters below around the text.

> *I'm bold text*
> /I'm italic text/
> _I'm underlined text_
> =I'm verbatine text=
> ~I'm a code smaple~
> +I'm strikethrough text+

### Images & Links

Images and links have the same format use double square brackets to encase the filename. ElCato will check if an image extension is present at the end of the path and put in the appropriate tag. Image files will also be copied to a new location on export you can do local image previews to ensure the links are good.

> [[./image/path/image01.png]]
> [[https://gitlab.com][Link text]]

## Tables

You can create a table by starting a line with a pipe symbol, the table will be formatted on tab.

> :| header 1 | header 2 |
> |----------+----------|
> | row 1 | column 2 |
> | row 2 | column 2 |

This will be formatted like below

header 1 | header 2
row 1 | column 2
row 2 | column 2

### Advanced usages

Generating a results table from a source code block, append :results value table to the src block.

    1
    2
    3
    4
    5
    return  [
        ["h1", "h2"],
        None,
        ["r1c1", "r1c2"],
        ["r2c1","r2c2"]]

The output of the above code will be a table formatted like below.

> Table example| h1 | h2 |
> |------+------|
> | r1c1 | r1c2 |
> | r2c1 | r2c2 |
> * Bullets
> ** Unordered lists
> To specify an unordered bullet list use + or - at the beginning of a line and on subsequent lines
> #+BEGIN_EXAMPLE
> + unordered bullet item list 1
> + unordered bullet item list 2
> #+END_EXAMPLE
> ** Ordered lists
> Ordered lists should have a number followed by a dot the numbering will be override by your html template's numbering.
> #+BEGIN_EXAMPLE
> 1. ordered bullet item list 1
> 2. ordered bullet item list 2
> #+END_EXAMPLE
> * Source blocks
> To generate a standard source code block simply specify begin and end block with the required language like below.
> #+BEGIN_EXAMPLE
> #+BEGIN_SRC shell
> elcato create --path=/tmp/myblog
> #+END_SRC
> #+END_EXAMPLE
> You can exclude source or result blocks by settings export settings of either code results or both.
> #+BEGIN_EXAMPLE
> #+BEGIN_SRC shell :exports results
> elcato create --path=/tmp/myblog
> #+END_SRC
> #+END_EXAMPLE
> ** Advanced usages
> *** Using results of a block in next block
> To use the results of your source code block in the next source block make sure you name your block.
> In this example we run a sql block and assign the results to the name =sqlresults= for use in the next block.
> #+BEGIN_EXAMPLE
> #+NAME: sqlresults
> #+BEGIN_SRC sql
> select vm.name, vm.slug, vp.name, vp.slug from manufacturer vm cross join product_type order by vm.slug;
> #+END_SRC
> #+END_EXAMPLE
> You can then assign the results to a variable which you can use in the next code block, it can be a different language and you can chain multiple blocks.
> You can also generate source code in this method, in this example we take the results of a sql block and generate some sql using python outputting the results to another source code block which we can run.
> This allow us to preview the results before running the sql.
> #+BEGIN_SRC python :results value code :wrap "SRC sql" :var res=sqlresults
> results = ]
> for row in res:
> results.append(
> f"insert into pages (name, slug) VALUES ('{row0]}', '{row1]}');"
> )
> return "\n".join(results)
> #+END_SRC
> * Custom org layout
> ** Change the export style sheet with the bellow meta data
> If your using org's export you can include a style sheet to render a html page nicely this is completely separate from ElCato.
> #+BEGIN_EXAMPLE
> #+HTML_HEAD: <link rel="stylesheet" type="text/css" href="view-source:https://edwardtufte.github.io/tufte-css/tufte.css" />
> #+END_EXAMPLE