Show HN: Textual Markdown – a Markdown “browser” in the terminal (github.com)
Hi HN,
This is a TUI app which displays interactive Markdown documents. Interactive in the sense that you can scroll code fences / tables / and click links. There's a Table of Contents extracted from the MD, and a very rudimentary browser like forward + back.
I'm thinking it could be the starting point for a variety of hypertext like applications in the terminal.
Very much a work in progress.
29 comments
[ 4.2 ms ] story [ 69.7 ms ] threadI happen to like the styling you choose for the different elements (eg H1, H2 headers etc) but is it fairly straight forward to adjust that styling with Textual CSS?
From a quick peek in the widgets.py file it looks like there's a DEFAULT _CSS value set in a lot of them, so maybe there's a way to adjust via that?
I think a major pro of browsers serving content in a limited markup language (with Gopher being the extreme example) is that a variety of applications can realistically work with rendering them, without having to offload everything to a web browser.
I've been wanting to write a simple markdown renderer so that I can view my notes/todo in a nicer form without having to generate a PDF or open by browser, so I'm very excited to take a look at this codebase later.
These notes contain diagram code like plantUML/graphviz and mermaid. I have been resorting to also rendering them in ascii to still gain value out of them if viewed from the terminal only.
This should complete my setup where diagrams/math rendering and all code could be rendered together.
Thanks for sharing!
Markdown lacks the ability to support arbitrary names anchors so it's difficult to provide links to a portion of a document that isn't a heading. It also has no ability to build HTML forms so you don't have any interactivity. It's also extremely limited for embedding media.
An application (remote, localhost, or whatever) can spit out HTML5 and get a lot of free functionality with an unmodified browser. HTML5 forms support input types so you get some free input validation. It supports displaying multiple types of media. Browsers also have a lot of accessibility features just built in and available with the appropriate markup. No JavaScript required.
Basic HTML is very functional all by itself. Any application wanting to use functionality beyond reading just plain text will run into Markdown's limitations. If most of what people actually want to do is blocked by Markdown's limitations no one will use it which makes the effort a bit pointless.
To your point, delivering raw Markdown to the browser means the browser needs to implement a renderer that supports inline HTML. If you're doing that you might as well just deliver that Markdown pre-rendered as HTML. Then you can be sure the browser will get the inline HTML that way it was intended.
Markdown is great for writing "plain" text that's perfectly readable by humans but can be trivially converted to some delivery format. It's not really fit for purpose as a delivery format.
I couldn't help but think of Gemini[0,1] and the number of applications already built for it[2] precisely because of the limited language. Gemini is an exciting space for lovers of a safer and lightweight internet.
It becomes clear that when rendering (and feature-bloat) are reduced, development begins to thrive. The Lagrange browser[3] is a great example of rendering not being an issue which gives developers time to build a great browser. For anyone curious, check it out to see what I mean: portable versions are available on Windows and Linux (appImage).
I have to admit that textual-markdown (OP) has me feeling the same way. I've been using command line browsers (on/off) for decades (since DOS). I don't know if I've ever seen a text-based browser look so beautiful. Wish the author the motivation and passion to keep this project going. I think it has great potential.
[0] https://gemini.circumlunar.space/
[1] https://en.wikipedia.org/wiki/Gemini_(protocol)
[2] https://gemini.circumlunar.space/software/
[3] https://github.com/skyjake/lagrange
Or if you just want cool, colorful markdown rendering in the terminal, and some management of MD files, but without link following or other interaction, there is glow:
https://github.com/charmbracelet/glow
As I mentioned at the time, I normally just use Vim to look at markdown in the terminal - the point of markdown is that it's supposed to be easy to read as text, all the more so with syntax highlighting
On my wishlist for a tool like this is inline images in the terminal for terminal emulators that support it, eg iterm2