summaryrefslogtreecommitdiffstats
path: root/docs/_posts/2022-08-06-markdown-support.md
blob: 4504bbd43926b545a79f4f6b6326ff247f0d33e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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>