Cherrytree, a hierarchical outliner

Structured

© Lead Image © Tele52, 123RF.com

© Lead Image © Tele52, 123RF.com

Article from Issue 184/2016
Author(s):

Cherrytree is a powerful note-taking application that orders text, images, tables, and references hierarchically.

Arranging information by rank or in tree structures has become second nature for people who work on computers, so it makes sense to use an outliner that manages data in this way. Cherrytree [1] is essentially an editor that lets you structure text extensively with images and hyperlinks.

Cherrytree uses "nodes" as the essential management unit for all information. Nodes "collect" snippets of information and serve as anchors for branches. Although nodes have names, like headers in documents or memos, they have nothing to do with the name of the document. Your document is not named until you save the tree for the first time via File | Save or Save As. Before saving, you need to set the file format of the document (Figure 1). Typically you will use a SQLite database as the document type because it loads quickly and can be edited easily. Although you can password protect files, you should treat this function with caution: When an encrypted document is opened, Cherrytree creates an unencrypted version in /tmp/ that is used for editing. Cherrytree supports auto-save, which is activated in the Preferences dialog.

Figure 1: When saving a Cherrytree document (i.e., the entire tree structure), you need to specify the type of document.

Installing Cherrytree

Cherrytree installed without problem on Fedora Workstation 23 using the graphical Software application installer. To install on Ubuntu 12.04 Precise to Ubuntu 14.04 Trusty (no stable versions yet exist for Systemd Ubuntu), open a terminal and enter:

$ sudo add-apt-repository ppa:vincent-c/cherrytree

Before continuing, you should open the Software Center and click Edit | Software Sources. In the Ubuntu Software tab, check the Community-maintained(universe) and Source code boxes. In the Other Software tab, make sure both vincent-c repositories are checked – main and main (Source Code). Now close the Software Center, return to the terminal, and enter:

$ sudo apt-get update
$ sudo apt-get install cherrytree

Cherrytree does not show up in a Dash search, so just enter the following: :$ cherrytree

in the terminal to start up the program.

Nodes

Nodes in some programs (e.g., Zim [2]) are separate files. In Cherrytree, however, a node appears as a subunit within the document as a whole, which has both advantages and disadvantages. For example, access to nodes is usually much faster this way, although it is then no longer possible to copy individual nodes (files) separately or to save only modified nodes when backing up.

To start a new project in an empty window (Figure 2), choose File | New Instance. The first step always is to insert a node. Cherrytree has multiple ways in which you can access most actions: by the menu or toolbar (Figure 3), the right-click context menu, and via keyboard shortcuts (Table 1). Once you have created a node, you can insert, modify, and remove information in that node.

Figure 2: A new project comprises two parts: The tree structure (left) and the current node (right).
Figure 3: Two ways to access Cherrytree actions: the menu and the toolbar.

Table 1

Important Keyboard Shortcuts

Shortcut

Function

Shortcut

Function

Ctrl+O

Open document

Ctrl+M

Monospace font

Ctrl+S

Save document

Ctrl+Alt+1

Bullet list

Ctrl+Shift+S

Save document as

Ctrl+Alt+2

Numbered list

Ctrl+P

Print document

Ctrl+Alt+3

To-do list

Ctrl+Shift+P

Document print options

Ctrl+Alt+F7

Repeat formatting

Ctrl+Alt+P

Preferences

Ctrl+N

New peer node

Ctrl+Z

Undo

Ctrl+Shift+N

New subordinate node

Ctrl+Y

Redo

F2

Edit node type

Ctrl+Alt+I

Insert image

F8

Insert node with today's date

Ctrl+Alt+T

Insert table

Ctrl+T

Search in node name and tags

Ctrl+Alt+C

Insert code box

Ctrl+Shift+T

Edit node name

Ctrl+Alt+E

Insert file

Del

Remove node

Ctrl+Alt+A

Insert anchor

Alt+Left arrow

Go to previous node

Ctrl+Alt+M

Insert timestamp

Alt+Right arrow

Go to next node

Ctrl+R

Insert horizontal line

Ctrl+F

Search in the (current) node

Ctrl+L

Insert or edit link

Ctrl+Shift+F

Search in all nodes

Ctrl+X

Cut

Ctrl+Alt+F7

Search in all selected nodes

Ctrl+C

Copy

F3

Repeat search forward

Ctrl+V

Paste

F4

Repeat search backward

Ctrl+Shift+V

Insert as unformatted text (not with links)

Ctrl+H

Replace in the current node

Ctrl+K

Delete line

Ctrl+Shift+H

Replace everywhere

Ctrl+D

Duplicate line

Ctrl+Alt+H

Replace in selected nodes

Ctrl+B

Bold

Ctrl+Shift+A

Open Replace dialog

Ctrl+I

Italics

F6

Continue replace

Ctrl+U

Underline

F9

Switch tree display

Ctrl+E

Strikethrough

Ctrl+Shift+A

Open Replace dialog

Ctrl+1

h1 Head

Ctrl+H

Replace

Ctrl+2

h2 Head

Ctrl+Shift+J

Switch node representation

Ctrl+3

h3 Head

Ctrl+Shift+E

Expand node representation

Ctrl+0

Small font

Ctrl+Shift+L

Collapse node representation

The Tags for Searching field lets you specify meta-tags (i.e., information that is not in the node content or node name but that still belongs to the node). However, you will only be able to find keywords defined this way using Search | Find in Nodes Names and Tags [sic] (or using Ctrl+T); all other search functions ignore these tags. Incidentally, this function is one of the few that helps bypass somewhat the strict hierarchical concept. Unfortunately, there is no further support for this approach.

In principle, you can work with Cherrytree as you would with any note or keyword management software: You create a number of nodes, which you can branch and network hierarchically; each node can receive any number of sub-nodes. You can also use hyperlinks and integrate external files. Nodes are one of two types: peer nodes and subordinate (derived) nodes. Whereas the first type is a new information node on the same hierarchical level as another node – like a new chapter in a book – subordinate nodes generate something like sections within a chapter or sub-sections within sections.

In specifying the node type, you confer certain properties on it. Cherrytree supports three variants (Figure 4).

Figure 4: When creating nodes, you determine its type and other properties.
  • Rich Text is the most frequently used node type. Only this type of node allows the formatting described in the "Rich Text Features" box and is mainly intended for everyday word processing. In rich text nodes, you can integrate tables, images, hyperlinks, code boxes, and so on.
  • Plain Text files have no formatting or additional structures, such as tables or pictures.
  • Automatic Syntax Highlighting nodes are provided for programming languages or code snippets. Shell code is the default, but the corresponding syntax highlighters are available for almost all widely used programming languages. You can select and configure the syntax highlighters using the drop-down box.

Rich Text Features

The list of Cherrytree's special features is long. One of its most important features is the ability to enter and format data as rich text (RTF), which allows the following formatting capabilities:

  • Foreground and background colors
  • Bold, normal, monospace, and italics
  • Superscript and subscript
  • Underline and strikethrough
  • Tiny font
  • Justified text
  • Three levels of heads (with TOC)
  • Automatic syntax highlighting for many programming languages
  • Code boxes (with and without syntax highlighting and numbering)
  • Images and text from external files
  • Spell checking (when enabled in Preferences
  • Bulleted, numbered, and to-do lists
  • Simple tables
  • Hyperlinks to text, images, web pages, files, and directories
  • Imported HTML files with the essential parts of the layout preserved

Content

In addition to plain and formatted text, you have the option to add additional structures, such as lists, tables, images, and references. Using Edit | Insert Image (keyboard shortcut Ctrl+Alt+I), browse for the file you want to add. A simple dialog (Figure 5) allows you to rotate the image using the buttons on the left and right and change the size in the Width and Height fields below the preview. If you only change one dimension, Cherrytree automatically scales the other to preserve the aspect ratio. You can confirm the change by clicking OK.

Figure 5: Inserting images is simple, but you don't have many options.

Cherrytree also accommodates tables (Edit | Insert Table; Ctrl+Alt+T) and requires that you define the table dimensions in advance (Figure 6). You also have to define the width of columns in advance, which often doesn't make sense. This method is a bit cumbersome because you will have to manually edit the tables again later if the requirements change by right-clicking the table and opening up the context menu (Figure 7). Notice that the context menu does not have an option to add a column; however, if you double-click a header cell, you can choose the Add Column radio button and name a new column that appears to the right of the column you clicked. The Import from CSV File (comma-separated value file) in the Insert Table dialog (Figure 6) works as expected.

Figure 6: You define tables when creating them; however, table configurations can be changed later.
Figure 7: The context menu includes many options for changing existing tables.

Inserting tables of contents (TOCs) is easy in Cherrytree (Edit | Insert TOC; menu and context menu only). You can add a TOC for the current node, for the current node and all its sub-nodes, or for the entire tree. Within a node, heads make up the TOC; among nodes, node names and heads compose the TOC. A TOC always appears at the very beginning of the node.

Cherrytree has an import function (Tree | Nodes Import) that imports (structured) information from other outliner or memo programs, as well as other structured formats, such as HTML, and converts them into native Cherrytree format. This is particularly useful to unlock the information contained within saved HTML pages. Figure 8 shows what happens, for example, if this is done with a locally saved page. Although it can be easy to correct formatting and links, it means a lot of additional work. Don't bother using the mouse when making corrections to links, because clicking even an incorrect link immediately opens a browser window. Only keyboard shortcuts will work there.

Figure 8: A saved HTML page imported into Cherrytree. Sometimes this process leaves artifacts behind.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More

News