elvish/website
Qi Xiao 3b27569e2c pkg/elvdoc: Remove support for "#doc:fn".
This construct is only used in two places - grouping numerical comparison
commands together and grouping string comparison commands together. However,
grouping them together makes it impossible to look up their individual elvdocs,
for example using "doc:show '<'", so abandon this half-baked grouping mechanism.

In future a more general mechanism to group symbols together may be introduced.

Document != and !=s as if they only take two arguments, addressing #1767. The
actual change will be done in a separate commit.
2024-02-18 10:47:17 +00:00
..
blog Update website for 0.20.1 release. 2024-02-14 13:34:31 +00:00
cmd pkg/elvdoc: Remove support for "#doc:fn". 2024-02-18 10:47:17 +00:00
favicons website: Restructure directory. 2020-06-14 13:56:58 +01:00
fonts website: Serve fonts as individual files. 2021-11-10 23:43:44 +00:00
get Update website for 0.20.1 release. 2024-02-14 13:34:31 +00:00
home website: Make the content div have "content" as a class instead of id. 2023-05-01 01:01:18 +01:00
learn pkg/elvdoc: Remove support for "#doc:fn". 2024-02-18 10:47:17 +00:00
ref pkg/elvdoc: Remove support for "#doc:fn". 2024-02-18 10:47:17 +00:00
tools pkg/elvdoc: Remove support for "#doc:fn". 2024-02-18 10:47:17 +00:00
.gitignore website: Move ttyshots to be side by side with markdown files. 2022-08-04 23:38:58 +01:00
gen-fonts.elv website: Serve fonts as individual files. 2021-11-10 23:43:44 +00:00
go.mod Require Go 1.21. 2024-02-10 17:44:46 +00:00
go.sum Upgrade dependencies. 2024-01-09 13:45:32 +00:00
home.md website: Overhaul styling. 2023-04-29 16:55:10 +01:00
icon-font.css website: Add anchor link for each header. 2021-11-30 01:14:02 +00:00
index.toml website: Move ttyshots to be side by side with markdown files. 2022-08-04 23:38:58 +01:00
Makefile website/cmd/md2html: Reduce dependency on Elvish packages. 2024-01-09 13:36:57 +00:00
README.md website: Remove the dependency on SQLite3 CLI for generating docset. 2024-01-22 16:16:56 +00:00
reset.css _website -> website. 2019-12-23 20:04:14 +00:00
style.css website: Make the content div have "content" as a class instead of id. 2023-05-01 01:01:18 +01:00
template.html website: Make the content div have "content" as a class instead of id. 2023-05-01 01:01:18 +01:00

Source for Elvish's website

This directory contains source for Elvish's official website.

The documents are written in CommonMark sprinkled with some HTML and custom macros. Most of them can be viewed directly in GitHub; notable exceptions are the homepage (home.md) and the download page (get/prelude.md).

Building

The website is a collection of static HTML files, built from Markdown files with a custom toolchain. You need the following software to build it:

  • Go, with the same version requirement as Elvish itself.

  • GNU Make (any "reasonably modern" version should do).

To build the website, just run make. The built website is in the _dst directory. You can then open _dst/index.html or run an HTTP server within _dst to preview.

NOTE: Although the website degrades gracefully when JavaScript is disabled, local viewing works best with JavaScript enabled. This is because relative paths like ./get will cause the browser to open the corresponding directory, instead of the index.html file under it, and we use JavaScript to patch such URLs dynamically.

Additional workflows

  • Run make check-rellinks to ensure that relative links between pages are valid.

  • Run make Elvish.docset to build a docset containing all the reference docs. Docset is a format for packaging documentation for offline consumption.

Both workflows use a Python script under the hood, and require Python 3 and Beautiful Soup 4 (install with pip install --user bs4).

Transcripts

Documents can contain transcripts of Elvish sessions, identified by the language tag elvish-transcript. A simple example:

```elvish-transcript
~> echo foo |
   str:to-upper (one)
▶ FOO
```

When the website is built, the toolchain will highlight the echo foo | str:to-upper (one) part correctly as Elvish code.

To be exact, the toolchain uses the following heuristic to determine the range of Elvish code:

  • It looks for what looks like a prompt, which starts with either ~ or /, ends with > and a space, with no spaces in between.

  • It then extends the range downwards, as long as the line starts with N whitespaces, where N is the length of the prompt (including the trailing space).

As long as you use Elvish's default prompt, you should be able to rely on this heuristic.

Ttyshots

Some of the pages include "ttyshots" that show the content of Elvish sessions. They are HTML files with terminal attributes converted to CSS classes, generated from corresponding instruction files. By convention, the instruction files have names ending in .elvts (because they are syntactically Elvish transcripts), and the generated HTML files have names ending in .ttyshot.html.

The generation process depends on tmux and a built elvish in PATH. Windows is not supported.

Instruction syntax

Ttyshot instruction files look like Elvish transcripts, with the following differences:

  • It should not contain the output of commands. Anything that is not part of an input at a prompt causes a parse error.

  • If the Elvish code starts with # followed immediately by a letter, it is treated instead as a command to sent to tmux.

    The most useful one (and only one being used now) is send-keys.

For example, the following instructions runs cd /tmp, and sends Ctrl-N to trigger navigation mode at the next prompt:

~> cd /tmp
~> #send-keys C-N

Generating ttyshots

Unlike other generated website artifacts, generated ttyshots are committed into the repository, and the Makefile rule to generate them is disabled by default. This is because the process to generate ttyshots is relatively slow and may have network dependencies.

To turn on ttyshot generation, pass TTYSHOT=1 to make (where 1 can be replaced by any non-empty string). For example, to generate a single ttyshot, run make TTYSHOT=1 foo.ttyshot.html. To build the website with ttyshot generation enabled, run make TTYSHOT=1.

The first time you generate ttyshots, make will build the ttyshot tool, and regenerate all ttyshots. Subsequent runs will only regenerate ttyshots whose instruction files have changed.

Commit History

These files used to live in a separate repository. However, because @xiaq did not merge the repositories in the correct way (he simply copied all the files), the commit history is lost. Please see that repository for a full list of contributors.