Compare commits

...

6 Commits

16 changed files with 249 additions and 11 deletions

1
site/.gitignore vendored
View File

@@ -4,3 +4,4 @@ themes
build
storage
node_modules
diagrams/*.svg

18
site/Makefile Normal file
View File

@@ -0,0 +1,18 @@
DIAGRAMS_IN := $(wildcard diagrams/*.typ)
DIAGRAMS_OUT := $(DIAGRAMS_IN:%.typ=%.svg)
diagrams/%.svg: diagrams/%.typ
typst compile $< $@
.PHONY: clean diagrams build serve
diagrams: $(DIAGRAMS_OUT)
clean:
rm -rf diagrams/*.svg
build: diagrams
zola build
serve: diagrams
zola serve

View File

@@ -1,3 +1,9 @@
This directory hosts the Kerolox website.
Documentation on how to contribute to the site itself lives in at `./content/contribute/site.md`.
- TODO: [PWA support](https://abridge.pages.dev/overview-abridge/#pwa) for mobile sandbox
- TODO: document how to report bugs and get help
- TODO: cookbook for common Kerolox idioms
- TODO: tag example pages by demonstrated concept
- TODO: favicon

View File

@@ -3,4 +3,6 @@ title = "Architecture"
description = "A tour through Kerolox's codebase architecture."
+++
{{ diagram(name="crates", alt="A block architecture diagram of every Rust crate in the Kerolox codebase.") }}
TODO

View File

@@ -3,4 +3,6 @@ title = "Build from Source"
description = "How to build Kerolox from source."
+++
# Cloning the Repository
TODO

View File

@@ -0,0 +1,22 @@
+++
title = "Security"
description = "Kerolox's security policy and it affects contributions."
+++
TODO
# npm
Unfortunately for everybody, JavaScript is the language of the web. Kerolox does its best to be free of dependencies on web technology, but occasionally, some JavaScript-based tooling is necessary. We encourage _secure_ use of npm whenever possible and avoid npm whenever security cannot be guaranteed.
[npm](https://www.npmjs.com/) and its package repository are the main tools for creating web-compatible JavaScript. It's also infamously vulnerable[^mini-shai-hulud][^tanstack] to [supply chain attacks](https://en.wikipedia.org/wiki/Supply_chain_attack). Because npm is configured to run arbitrary scripts while installing packages, this means that anybody installing dependencies from the npm package registry is at risk.
[^mini-shai-hulud]: [Mini Shai-Hulud attack](https://www.aikido.dev/blog/mini-shai-hulud-is-back-tanstack-compromised)
[^tanstack]: [Tanstack supply chain attack](https://tanstack.com/blog/npm-supply-chain-compromise-postmortem)
- TODO: describe npm workarounds
- TODO: CVE reporting policy
- TODO: dependency updating strategy
- npm-based stuff is under extra scrutiny
- TODO automatic secret sanitation

View File

@@ -3,15 +3,39 @@ title = "Website"
description = "How to contribute to the Kerolox website."
+++
- TODO: [PWA support](https://abridge.pages.dev/overview-abridge/#pwa) for mobile sandbox
- TODO: Atkinson Hyperlegible Next
- TODO: document how to report bugs and get help
- TODO: document security policy
- CVE reporting policy
- dependency updating strategy
- npm-based stuff is under extra scrutiny
- automatic secret sanitation
- TODO: cookbook for common Kerolox idioms
- TODO: tag example pages by demonstrated concept
This website is extremely important to the project because it contains the main onboarding documentation for new users. It also hosts contributor documentation such as what you're reading now. If you have ideas on how to improve it, please let us know![^help-contact]
TODO
[^help-contact]: TODO: provide direct contact guidelines
# Dependencies
The site is generated using [Zola](https://www.getzola.org), a reasonably minimal static site generator. Each page is written in [Markdown](https://www.markdownguide.org/) and templated into HTML. You can find instructions to install Zola [here](https://www.getzola.org/documentation/getting-started/installation/).
To best communicate visual information throughout our documentation, we use [Typst](https://typst.app/) to generate diagrams during the site compilation process. It's a required dependency for building the site, so please follow [Typst's installation instructions](https://github.com/typst/typst#installation) to install it for your system.
We use the [Abridge](https://github.com/jieiku/abridge/) Zola theme to provide our styling and HTML templating. It provides lots of web accessibility features while staying lightweight. The theme _does_ use `npm` for some preprocessing, so please bear in mind [our npm security guidelines](@/contribute/security.md#npm) while customizing it. Use of npm for contributing to the site should not be necessary very often, though.
Abridge is included as a [Git submodule](https://git-scm.com/book/en/v2/Git-Tools-Submodules), so in order to build the website, you must update that submodule. If you've already [cloned the repository](@/contribute/build.md#cloning-the-repository), you can ensure that the Abridge submodule is updated correctly by running the following commands:
```sh
git submodule init
git submodule update
```
# Building the Website
To build the website, run `make` in the `site` directory of the repository:
```sh
make build
```
This will automatically build all dependencies of the website, run Zola to compile the website itself, then place the results in `site/public`.
To rapidly iterate on the website, you can also use the `serve` target:
```sh
make serve
```
This runs Zola as an HTTP server of the site's content at `http://localhost:1111`. Note that while Zola will reload the _contents_ of the site, the _dependencies_ of the site, such as Typst diagrams, will _not_ be. To reload those, kill the server with `Ctrl+C` and run `make serve` again.

52
site/diagrams/crates.typ Normal file
View File

@@ -0,0 +1,52 @@
#set page(width: auto, height: auto, fill: none, margin: 0em)
#set text(font: "Atkinson Hyperlegible Next", size: 18pt, fill: white)
#set grid(align: center + horizon)
#let gutter = .45em
#let stroke = (paint: gray, dash: "dashed")
#let block(height: 1em, cell) = pad(gutter, box(
radius: 5pt,
stroke: white,
fill: black,
inset: gutter,
width: 100%,
height: height + gutter * 2,
cell,
))
#grid(
columns: (8em, 4em, 12em),
grid.cell(colspan: 3, block[cli]),
grid.hline(stroke: stroke),
grid.vline(stroke: stroke, x: 1, start: 1),
pad(.5em, [Backend]),
grid.cell(colspan: 2, pad(.5em, [Frontend])),
grid.cell(rowspan: 3, grid(
block(height: 2em + gutter, [clingo]),
block(height: 2em + gutter, [eval]),
)),
grid.cell(
colspan: 2,
grid(
columns: 4,
block[lsp], block[check], block[dox],
),
),
grid.cell(colspan: 2, block[frontend]),
grid.cell(colspan: 2, block[core]),
grid.hline(stroke: stroke),
grid.cell(
colspan: 2,
block[IR],
),
block[tree-sitter-kerolox],
)

3
site/sass/abridge.scss Normal file
View File

@@ -0,0 +1,3 @@
@use '../themes/abridge/sass/abridge' with (
$font: 'Atkinson Hyperlegible Next',
);

Binary file not shown.

Binary file not shown.

Binary file not shown.

93
site/static/fonts/OFL.txt Normal file
View File

@@ -0,0 +1,93 @@
Copyright 2020-2024 The Atkinson Hyperlegible Next Project Authors (https://github.com/googlefonts/atkinson-hyperlegible-next)
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
https://openfontlicense.org
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.

View File

@@ -0,0 +1,8 @@
<figure
class="diagram"
role="img"
aria-label="{{ alt }}"
>
{{- load_data(path="diagrams/" ~ name ~ ".svg") | safe -}}
<figcaption>{{ alt | markdown(inline=true) }}</figcaption>
</figure>

View File

@@ -18,6 +18,13 @@ theme = "catppuccin-mocha"
[extra]
fonts = [
{ url = "fonts/AtkinsonHyperlegibleNext-Bold.ttf" },
{ url = "fonts/AtkinsonHyperlegibleNext-BoldItalic.ttf" },
{ url = "fonts/AtkinsonHyperlegibleNext-Italic.ttf" },
{ url = "fonts/AtkinsonHyperlegibleNext-Regular.ttf" },
]
[[extra.menu]]
url = "tutorial"
name = "Tutorial"