wd is an artifact from an alternative timeline. In this timeline, web browsers never gained any graphical features, and the web remained centered on text. Markdown became the dominant language for arranging documents, as HTML was abandoned shortly after invention.
Somehow though, JavaScript made it through! The APIs available were obviously very different to what we're used to in our timeline, and quite a bit more limited in terms of interactivity.
wd uses a handful of libraries, all of which are readily available.
Hint: don't bother opening these in wd
, as they're HTML sites.
- curl - for fetching documents over http
- openssl - for the https part of libcurl
- cmark-gfm - for parsing markdown
- termbox - for cross-platform terminal support
- duktape - for executing javascript
- uriparser - for parsing and manipulating urls
Optionally, you can skip installing cmark-gfm
, termbox
, duktape
, and
uriparser
by running make wd_vendor=1
, which will build new copies from
the vendor
directory. Upsides: less stuff to install. Downsides: the install
might not be tailored to your system. You might have to adjust some configs to
make it work.
Once you have all those libraries installed, you should just be able to run
make
, which will build a wd
binary for you.
Really easy - if you run wd
with no arguments, it'll open to a blank page.
If you run it with one argument, it'll open that as its initial URL. There are
no switches or configuration parameters yet.
A fun way to try it out is to run ./wd file://README.md
after building -
this will open this very file!
JavaScript in this timeline is a bit weird. As markdown doesn't have as rich a syntactic tree as HTML, there's no easy way to identify individual nodes.
Hint: if you open this page in wd
, it will actually execute this code and
display a message at the bottom of your window.
/*@wd@*/
set_message(
"the document object is a `" +
document.type +
"` node with " +
document.children.length +
" children! your lucky number is: " +
Math.round(Math.random() * 1000)
);
Try following these links in wd
!
I've got quite a bit planned that I'm yet to implement. This list is not in any particular order.
- Media file support using image tags, behaving like elinks
- Self-contained writable "application" documents
- More JavaScript functionality
- On-page databases accessible to JavaScript using markdown tables
- Event loop for timers in JavaScript
- DOM-like traversal
- Nested lists