Ha.nnes.dev


📖

emdien

Search and read MDN locally in the terminal.

Language: Go
Source code: GitHub

Search and read MDN locally in the terminal. Similar to mdn-cli, but works without an internet connection.

Installation

You can download a precompiled binary from the releases page, rename the file to mdn and place it in a location in your PATH, e.g. $HOME/.local/bin/mdn.

Usage

Download and index the MDN data files:

mdn --update

Then, you can query MDN by running the mdn command, e.g. to search for "html":

mdn html

Search terms can be separated by spaces:

mdn css grid layout

You'll need to use quotation marks around terms containing special characters:

mdn '<br />' tag

To get raw markdown output instead of pretty rendered markdown, use the --raw-output or -r flag:

mdn --raw-output html

Development

Building

Install Go 1.19 or later.

Install the Go dependencies:

go get .

Build the binary:

go build -o build/mdn

Pre-commit

Install pre-commit, then enable the pre-commit hooks in the repo:

pre-commit install