Tp-Note news: produce, retrieve and consume note files on the console
The template based note-taking tool Tp-Note was originally designed as desktop application: Before creating a new note, the user copies interesting bits of text into the clipboard. When Tp-Note starts, it analyses the clipboard's content and fills out some template to create a new note. As Tp-Note makes extensive use of the clipboard, it mainly targets desktop systems running a graphical environment. But also when working on the console Tp-Note can be useful with its built-in clipboard simulation: Instead of copying the content into your clipboard, pipe it into Tp-Note 1:
echo "Some clipboard content" | tp-note
Tip: If you are new to Tp-Note, you may want to watch the introductory video about Tp-Note.
One of the advantages of taking notes as files, is the possibility to annotate artefacts in the file system and place the note next to them. This brings us to the use case I present you here: Take a note about the origin of a downloaded file. How to do this on the desktop is described here. But also on the console, when administrating a system through an SSH connection, this workflow is very common and involves several steps and tools:
-
Production: Take a note
-
Download a file (
wget
) -
Document the URL in a note (
tp-note
,vim
)
-
-
Retrieval: Search the file system for the note
- Browse note files / full text search (Midnight Commander
mc
)
- Browse note files / full text search (Midnight Commander
-
Consummation: Read the note and follow its hyperlinks
-
Render the note file (
tp-note
) -
Open and read the rendition (
lynx
) -
Follow hyperlinks (
lynx
)
-
Hereby is the Production stage 1. supported since Tp-Note version
1.8 already. The current version 1.10 offers some new features
targeting the support of the Retrieval stage 2. and the Consummation
stage 3.
The following examples work with the full featured version of Tp-Note as
well as with the --no-default-features
console-only version.
Production: Take notes
-
Download a file (
wget
)Download the file i3-extensions.zip:
wget "http://blog.getreu.net/_downloads/i3-extensions.zip"
-
Document the URL in a note (
tp-note
,vim
)echo "[download](<http://blog.getreu.net/_downloads/i3-extensions.zip>)" | tp-note i3-extensions.zip
Hint: you do not need to type the URL twice. The cursor key
[↑]
takes you back through Bash's history. Just go back to line with the URL, edit and press[Enter]
.
This creates the note file i3-extensions.zip--URL.md
with the
following content:
---
title: "i3-extensions.zip"
subtitle: "URL"
author: "getreu"
date: "2020-09-03"
lang: "en-GB"
---
[i3-extensions.zip](<i3-extensions.zip>)
[download](<http://blog.getreu.net/_downloads/i3-extensions.zip>)
Retrieval: Search the file system for the note
The Ncurses library based file manager MidnightCommander mc
enjoys great
popularity among people working on the console.
As Tp-Note stores the note's content in UTF-8 encoded plain text, mc
can be used for full text searches in all note files of a directory.
Start the full text search with the keys [Esc]
[?]
.
The following instructions configure mc
's [F3]
-key to open .md
files for
viewing. This is where Tp-Note generates the HTML rendition of the note
file and opens the rendition with the Lynx web browser. The [Enter]
-key
runs Tp-Note in editing mode.
-
First install the Midnight Commander and the Lynx web browser:
sudo apt install mc lynx
-
Edit
mc
's configuration file/etc/mc/mc.ext
:sudo nano /etc/mc/mc.ext
-
Replace the line
default/*
with:shell/i/.md Open=tp-note %f View=if HTML=`tp-note -b -n -x - %f`; then (echo $HTML | lynx --stdin); else less %f; fi default/*
-
Restart all instances of
mc
:sudo killall mc mc
To test the configuration, navigate to some .md
note file and
press [F3]
or [Enter]
. For full text search type [Esc]
[?]
.
Consummation: Read the note and follow its hyperlinks
When no graphical environment is available, Tp-Note disables the viewer
feature with its internal HTTP server. However, in order to follow
comfortably hyperlinks in you notes, you can always use Tp-Note's HTML
export function --export
or shorter -x
.
If you have configured the Midnight Commander mc
as described in the
previous section, just navigate to the note file and press [F3]
. This renders
the note's content and starts Lynx. Alternatively, you can invoke Tp-Note
and Lynx without mc
:
-
Install the text-based web browser
lynx
:sudo apt install lynx
-
Convert the existing note
20210122-my_note.md
into HTML and open the rendition withlynx
:tp-note -x - '20210122-my_note.md' | lynx --stdin
The above also works in case Tp-Note was compiled with
--no-default-features --features renderer
which is recommended for headless
systems.
Read more
A good start is Tp-Note's project page or the introductory video. The source code is available on GitHub - getreu/tp-note and some binaries and packages for Linux, Windows and Mac can be found here. To fully profit of Tp-note, I recommend reading Tp-Note's user manual. When you like Tp-Note, you probably soon want to customize it. How to do so, is explained in Tp-Note's manual page.
More examples can be found in Tp-Note's user manual.