[blog] post about markdown support

This commit is contained in:
Tim Stack 2022-08-06 02:11:37 -07:00
parent deb0e21554
commit 4e74491e84
3 changed files with 47 additions and 31 deletions

View File

@ -0,0 +1,33 @@
---
layout: post
title: Markdown Support
excerpt: A side effect of fancier help text
---
*(This change will be in the upcoming v0.11.0 release)*
As part of the effort to polish the lnav TUI, I wanted to make the builtin
help text look a bit nicer. The current help text is a plain text file with
some ANSI escape sequences for colors. It's not easy to write or read. Since
Markdown has become a dominant way to write this type of document, I figured
I could use that and have the side benefit of allowing lnav to read Markdown
docs. Fortunately, the [MD4C](https://github.com/mity/md4c) library exists.
This library provides a nice event-driven parser for documents instead of
just converting directly to HTML. In addition, document structure is now
shown/navigable through the new breadcrumb bar at the top. I think the
result is pretty nice:
<script id="asciicast-2hx3UiyzOHQXBQOBf31ztKvHc"
src="https://asciinema.org/a/2hx3UiyzOHQXBQOBf31ztKvHc.js"
async>
</script>
## Viewing Markdown Files
Files with an `.md` suffix will be considered as Markdown and will be
parsed as such. As an example, here is lnav displaying its README.md file:
<script id="asciicast-iw4rwddZNGCe3v8DyOfItERG9"
src="https://asciinema.org/a/iw4rwddZNGCe3v8DyOfItERG9.js"
async>
</script>

View File

@ -278,22 +278,13 @@ that you can always use `q` to pop the top view off of the stack.
| **&VerticalLine;**&lt;script&gt; [arg1...] | Execute an lnav script contained in a format directory (e.g. \~/.lnav/formats/default). The script can contain lines starting with `:`, `;`, or `\|` to execute commands, SQL queries or execute other files in lnav. Any values after the script name are treated as arguments can be referenced in the script using `\$1`, `\$2`, and so on, like in a shell script. |
| CTRL+], ESCAPE | Abort command-line entry started with `/`, `:`, `;`, or `\|`. |
Note: The regular expression format used by is PCRE
(Perl-Compatible Regular Expressions). For example,
if you wanted to search for ethernet device names,
regardless of their ID number, you can type:
eth\\d+
You can find more information about Perl regular
expressions at:
http://perldoc.perl.org/perlre.html
If the search string is not valid PCRE, a search
is done for the exact string instead of doing a
regex search.
> **Note**: The regular expression format used by lnav is
> [PCRE](http://perldoc.perl.org/perlre.html)
> (Perl-Compatible Regular Expressions).
>
> If the search string is not valid PCRE, a search
> is done for the exact string instead of doing a
> regex search.
## Session

View File

@ -425,21 +425,13 @@ can always use  q  to pop the top view off of the stack.
CTRL+], ESCAPE Abort command-line entry started with  / ,  : ,  ;
, or  | .
 Note: The regular expression format used by is PCRE 
 (Perl-Compatible Regular Expressions). For example, 
 if you wanted to search for ethernet device names, 
 regardless of their ID number, you can type: 
 
 eth\d+ 
 
 You can find more information about Perl regular 
 expressions at: 
 
 http://perldoc.perl.org/perlre.html 
 
 If the search string is not valid PCRE, a search 
 is done for the exact string instead of doing a 
 regex search. 
Note: The regular expression format used by lnav is PCRE[1]
▌(Perl-Compatible Regular Expressions).
▌ ▌[1] - http://perldoc.perl.org/perlre.html
▌If the search string is not valid PCRE, a search is done for
▌the exact string instead of doing a regex search.
Session