In What is Repla?, we explained how Repla is designed to be adaptable, just like text editors and terminals are, by being extended with packages that run processes. This post is about some of the use cases that this enables. But before we get to those, we have to talk about how Repla is different from text editors and terminals, because it’s through the differences that the use cases emerge.
In addition to being extensible through packages that run processes, text editors and terminals share another similarity, one that’s not shared by Repla: They’re both focused on plain text, while Repla is instead focused on rendering web content.
There are a lot of things a web renderer can do that plain text cannot. Some examples include displaying media, such as pictures, video, and graphics; rendering rich text with different combinations of fonts and colors; and it can be interactive, responding to input in any manner it chooses, in particular by supporting hyperlinks. When talking about Repla use cases, we’re looking for situations where we can take advantage of these attributes.
The first use case we’ll look at is the prototype Search plugin. This plugin makes the output of
grep commad-line tool interactive. Often considered the canonical Unix tool,
grep searches files for a regular expression, and prints the matching lines. Here’s what its output looks like searching Ruby files recursively for the search term
So the second line of output says the first match is in file
tc_controller.rb on line
19. While the output of
grep is quite useful on its own, it’s not interactive.
The Repla Search plugin displays the results of a
grep search rendered as HTML with the matching filenames as hyperlinks. Following a link for a filename opens that file in the default app for that file type. More interactive features can be added later, such as outliner functionality allowing each file’s matches to be collapsed, for example to only see the list of filenames with matches, or only leave the files you’re interested in expanded.
The prototype Markdown plugin is a natural match for Repla’s features, taking advantage of web rendering to display rich text and inline images, as well as being able to follow links.
There are already some great apps that do Markdown rendering, but the flexibility of Repla’s package model means similar plugins can be made for formats that aren’t yet supported by any existing apps. For example, a plugin for the Mermaid diagramming language would allow developers to track class and control-flow diagrams in version control alongside source code, just like Markdown files are today.
The REPL, or read–eval–print loop, is an environment where you enter source code and see the result of it being evaluated instantly. REPLs are an underutilized programming tool today, partially because using them usually requires writing source code at a plain command prompt, whereas most developers are accustomed to writing code in their own text editor, an environment that provides important features for programming such as syntax highlighting, autocomplete, and automatically checking for common issues.
Taking the REPL plugin one step further, the planned live coding plugins will execute an entire document through a REPL automatically, allowing you to see the results of your code executing live as you write it.
These are just a few use cases for Repla, a web renderer that can be extended with packages that can run processes, and there are many more. The real goal is to provide a new place where developers can solve their own problems by writing their own plugins for Repla, and then sharing them, the same way they do for text editors and terminals today.