ahre

Picture also, along the length of the wall, people carrying all sorts of implements which project above it, and statues of people, and animals made of stone and wood and all kinds of materials. As you’d expect, some of the people carrying the objects are speaking, while others are silent.


ahre is a text web browser for the terminal. It uses libcurl to transfer data and lexbor to parse the html, providing a textual user interface similar (but different) to that of edbrowse. It is a work in progress so many features are still waiting to be implemented and this site be updated accordingly.

Ahre presents the text from the documents, marking certain elements surrounding them with special characters and (unless launched with -m or --monochrome) with specific colors. (The monochrome mode tries to be more similar to edbrowse). It also assigns an ID for each element.

For example, <a> elements with href attribute are marked with square brackets. Thus, the first link will look like [0.first link text] the second [1.second link text], etc. Where the ids are represented in base 36 so the tenth will be [A.tenth link], the sixteenth [G.sixteenth link] and so on. In non-monochrome mode they will appear blue.

input elements are red and marked with curly brackets and images with parenthesis and shown green.

Since the interface is the keyboard, those characters are used to run commands specific to the corresponding element class. Thus, the command to navigate to the first link will be [0* (or [0 for short, since it is the most common command and therefore the default. You can use a range to refer to the elements in question. For example, if you want to show attributes of the links (including the href) you can use the " (double quote) command over a range (that of course could be of only one). Thus, [0,4" will print the first 5 links attributes as a message in the screen. You may use % for the full range (just like in vim).

There are not currently many commands for images but at least you can download the image 1 to a file with (1 > filename. Then, you can see it with your favorite image viewer. You may want to use ahre to display it in the terminal screen, but that feature is not a priority since you already have lots of programs to do that on the images you download with ahre.

Ahre currently supports only some input elements. For example the text (or search) inputs such as the one used in duck duck go has an equal sign between the id and its current value. You type {0=ahre if you want to set its value to search if duck duck go knows anything about ahre (it currently does't). The submit input, as well as the buttons, will use a bar / between the id and the text. For example, duckduckgo's look like {1/Search} and you can search for your input text with {1* (or, similarly to the anchors, with just {1).

The text itself is not marked, but you run commands on the text with the : character as prefix. For example, you navigate to the first line of the current page with :1 or you navigate forward to the first match of REGEX with :/REGEX. Note that you must prefix the slash with the colon.

You may be interested in looking at the source html of the document. For that you can use the "less than" commands. <w filename will write the source file as filename and </REGEX will search for REGEX. <% will print the file in the screen as a message.

The . is used for current document related commands. For instance ." show information of the current document (including its title and url), .draw will redraw it on the screen (useful after resizing the number of columns to be used to apply the change on the screen, more on this later). You can bookmark the current document with .+BOOKMARK_NAME or .+/BOOKMARK_NAME. The first will add the page to the given bookmark, creating it if necessary, the latter will search with any bookmark with prefix like the given string and only add it if it exists exactly one with that prefix. It may help if you usually introduce typos while typing.

Then you have the tab commands, that start with the | char. In ahre, the "tabs" form a tree with an empty root. Every time you "open" a link, that is present in a document, you add a new tab as a child of that document and update the current to the child you just created. You can navigate back and open another (or the same) url and you will add another child to the document, sibling to the first child you created. You can also open a url (more on this later) in which case you add a child to the root.

The | alone will show you all the entire tree as a message in the screen. Each tab will have a "path". 0. will be the first visited page, 1. will be a second one if it was opened by providing the url. The first link to open in this second page will have the path 1.0.. On the left you will see [+] on the current tab.

Each page opened via a url (not a link) will be a subtree all of whose child are pages opened by using links and which paths will start with the same number. For each of these sub trees you have a (sub)-current tab and will be indicated in the tabs message with [ ] (or [+] if it is the current).

So using the tab commands you go to the specific tab by typing |1.0. and so on. You can instead navigate to a subtree with |2 and you will switch to the current tab of the third subtree (the number 2). You navigate back with |-.

There are also the less specific "session" commands. You may run any session command preceding by it with the inverted bar \ char which is optional in the fgets and isocline modes, which are modes similar to edbrowse that minimize the amount of output the user receives. The visual mode (which has some shortcuts such as space bar to move page down and backspace to move one page up) requires the inverted bar to introduce session commands because if not it will interpret the input as shortcuts, so you "escape" the shortcut with the bar.

You can always append ? to a command or sub command and get either a list of sub command or the docs for that command (some docs may be incomplete, time is short).

For example \? lists:

that are the session commands and the mentions prefix chars.

The most used command is get. You may type only \g since there is no other command (yet at least) starting with the letter g. You fetch a page (open an url) with this command such as in \g ahre.pages.dev. This will fetch the page and add a subtree to the tabs. In visual more the first page will be shown (in more "textual" modes you can of course print all the lines with :%.

Another useful command is quit. And unlike vim you do not quit with :q but with \q instead.

The get command is also useful to open the bookmarks file. Ahre maintains a default bookmarks file (by default in ~/.config/ahre/bookmark.html). Ahre's bookmarks file is just like w3m's bookmark. It is a simple html file with one <h2> for each section. Also similarly as w3m, you can launch ahre with another bookmarks file with the -b or --bookmark option.

To open the bookmarks file you don't need to type the full path and you can type the "alias" \bookmark (the word bookmark preceded by \). \g\b is enough if there aren't any clashing aliases.

Any contribution is welcome. Please use the repository on codeberg.org for bug reports, patches or pull requests, or join the IRC channel #ahre on Libera.Chat.

Repository

Quick reference guide

Developer guide