mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-14 02:08:31 +02:00
Add recipe for visualizing Markdown in the CLI (#1354)
* Added Recipe for visualizing Markdown in the CLI, fixed some typos and added backticks in all references of jrnl * mdless recipe changes during review -condense language -make it sound less like an endorsement -add link about less -minor grammatical change Co-authored-by: Fidel H Viegas <me@fidelhviegas.com> Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
This commit is contained in:
parent
62dc037d80
commit
9f5c2f6829
1 changed files with 52 additions and 26 deletions
|
@ -28,7 +28,7 @@ You can do things like
|
||||||
jrnl @fixed -starred -n 10 -to "jan 2013" --short
|
jrnl @fixed -starred -n 10 -to "jan 2013" --short
|
||||||
```
|
```
|
||||||
|
|
||||||
To get a short summary of the 10 most recent, favourited entries before
|
To get a short summary of the 10 most recent, favourite entries before
|
||||||
January 1, 2013 that are tagged with `@fixed`.
|
January 1, 2013 that are tagged with `@fixed`.
|
||||||
|
|
||||||
### Statistics
|
### Statistics
|
||||||
|
@ -52,8 +52,8 @@ print exactly one line per entry).
|
||||||
|
|
||||||
### Importing older files
|
### Importing older files
|
||||||
|
|
||||||
If you want to import a file as an entry to jrnl, you can just do `jrnl < entry.ext`. But what if you want the modification date of the file to
|
If you want to import a file as an entry to `jrnl`, you can just do `jrnl < entry.ext`. But what if you want the modification date of the file to
|
||||||
be the date of the entry in jrnl? Try this
|
be the date of the entry in `jrnl`? Try this
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
echo `stat -f %Sm -t '%d %b %Y at %H:%M: ' entry.txt` `cat entry.txt` | jrnl
|
echo `stat -f %Sm -t '%d %b %Y at %H:%M: ' entry.txt` `cat entry.txt` | jrnl
|
||||||
|
@ -91,7 +91,7 @@ Body:
|
||||||
```
|
```
|
||||||
|
|
||||||
The `template.txt` file could be used to create a new entry with these
|
The `template.txt` file could be used to create a new entry with these
|
||||||
command line arguements:
|
command line arguments:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
jrnl < template.txt # Imports template.txt as the most recent entry
|
jrnl < template.txt # Imports template.txt as the most recent entry
|
||||||
|
@ -164,7 +164,7 @@ jrnl now --config-override editor:""
|
||||||
|
|
||||||
Bind this to a keyboard shortcut.
|
Bind this to a keyboard shortcut.
|
||||||
|
|
||||||
Map `Super+Alt+J` to launch the terminal with jrnl prompt
|
Map `Super+Alt+J` to launch the terminal with `jrnl` prompt
|
||||||
|
|
||||||
- **xbindkeys**
|
- **xbindkeys**
|
||||||
In your `.xbindkeysrc`
|
In your `.xbindkeysrc`
|
||||||
|
@ -180,6 +180,32 @@ Mod4+Mod1+j
|
||||||
bindsym Mod4+Mod1+j exec --no-startup-id alacritty -t floating-jrnl -e jrnl --config-override editor:""
|
bindsym Mod4+Mod1+j exec --no-startup-id alacritty -t floating-jrnl -e jrnl --config-override editor:""
|
||||||
for_window[title="floating *"] floating enable
|
for_window[title="floating *"] floating enable
|
||||||
```
|
```
|
||||||
|
### Visualize Formatted Markdown in the CLI
|
||||||
|
|
||||||
|
Out of the box, `jrnl` can output journal entries in Markdown. To visualize it, you can pipe to [mdless](https://github.com/ttscoff/mdless), which is a [less](https://en.wikipedia.org/wiki/Less_(Unix))-like tool that allows you to visualize your Markdown text with formatting and syntax highlighting from the CLI. You can use this in any shell that supports piping.
|
||||||
|
|
||||||
|
The simplest way to visualize your Markdown output with `mdless` is as follows:
|
||||||
|
```sh
|
||||||
|
jrnl --export md | mdless
|
||||||
|
```
|
||||||
|
|
||||||
|
This will render your Markdown output in the whole screen.
|
||||||
|
|
||||||
|
Fortunately, `mdless` has an option that allows you to adjust the screen width by using the `-w` option as follows:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
jrnl --export md | mdless -w 70
|
||||||
|
```
|
||||||
|
|
||||||
|
If you want Markdown to be your default display format, you can define this in your config file as follows:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
display_format: md
|
||||||
|
# or
|
||||||
|
display_format: markdown
|
||||||
|
```
|
||||||
|
|
||||||
|
For more information on how `jrnl` outputs your entries in Markdown, please visit the [Formats](./formats.md) section.
|
||||||
|
|
||||||
## External editors
|
## External editors
|
||||||
|
|
||||||
|
@ -201,7 +227,7 @@ tools for Sublime Text and configure your `jrnl.yaml` like this:
|
||||||
editor: "subl -w"
|
editor: "subl -w"
|
||||||
```
|
```
|
||||||
|
|
||||||
Note the `-w` flag to make sure jrnl waits for Sublime Text to close the
|
Note the `-w` flag to make sure `jrnl` waits for Sublime Text to close the
|
||||||
file before writing into the journal.
|
file before writing into the journal.
|
||||||
|
|
||||||
### Visual Studio Code
|
### Visual Studio Code
|
||||||
|
@ -252,20 +278,20 @@ grep -A 1 CFBundleIdentifier /Applications/iA\ Writer.app/Contents/Info.plist
|
||||||
### Notepad++ on Windows
|
### Notepad++ on Windows
|
||||||
|
|
||||||
To set [Notepad++](http://notepad-plus-plus.org/) as your editor, edit
|
To set [Notepad++](http://notepad-plus-plus.org/) as your editor, edit
|
||||||
the jrnl config file (`jrnl.yaml`) like this:
|
the `jrnl` config file (`jrnl.yaml`) like this:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
editor: "C:\\Program Files (x86)\\Notepad++\\notepad++.exe -multiInst -nosession"
|
editor: "C:\\Program Files (x86)\\Notepad++\\notepad++.exe -multiInst -nosession"
|
||||||
```
|
```
|
||||||
|
|
||||||
The double backslashes are needed so jrnl can read the file path
|
The double backslashes are needed so `jrnl` can read the file path
|
||||||
correctly. The `-multiInst -nosession` options will cause jrnl to open
|
correctly. The `-multiInst -nosession` options will cause `jrnl` to open
|
||||||
its own Notepad++ window.
|
its own Notepad++ window.
|
||||||
|
|
||||||
|
|
||||||
### emacs
|
### emacs
|
||||||
|
|
||||||
To use `emacs` as your editor, edit the jrnl config file (`jrnl.yaml`) like this:
|
To use `emacs` as your editor, edit the `jrnl` config file (`jrnl.yaml`) like this:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
editor: emacsclient -a "" -c
|
editor: emacsclient -a "" -c
|
||||||
|
|
Loading…
Add table
Reference in a new issue