Skip to content

Commit

Permalink
Use lume, overhaul frontpage and add a target list
Browse files Browse the repository at this point in the history
  • Loading branch information
Yatekii committed Sep 25, 2023
1 parent 0885047 commit 9558a89
Show file tree
Hide file tree
Showing 417 changed files with 7,369 additions and 84,369 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Build pages

on:
pull_request:

permissions:
contents: read
pages: write
id-token: write

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Clone repository
uses: actions/checkout@v4

- name: Setup Deno environment
uses: denoland/setup-deno@v1
with:
deno-version: v1.x

- name: Build site
run: deno task build
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
29 changes: 0 additions & 29 deletions .github/workflows/ci.yml

This file was deleted.

18 changes: 0 additions & 18 deletions .github/workflows/linkcheck.yml

This file was deleted.

7 changes: 2 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
/target
**/*.rs.bk
Cargo.lock

# Generated Zola files should not be added to git
public/
/_cache
.DS_Store
32 changes: 21 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,26 @@
# probe.rs
# The new probe.rs webpage

## Development

The entire webpage is built with [zola](https://www.getzola.org/) which is based on statically compiled Markdown and [tera](https://github.com/Keats/tera) templates.
You can run the file watcher & compiler with `zola serve` during development. The webpage will automatically be reloaded everytime you change any involved file.
## Goals

Currently, zola version 0.14 or higher is used.
- Create a more appealing frontpage that tells the visitor a bit better what we
have to offer.
- Provide simple installation instructions. Part of this initiative is building
proper release artifacts in the pipeline (see
[#1721](https://github.com/probe-rs/probe-rs/pull/1721)).
- Make the entry into `probe-rs` usage even easier.
- Explain how one uses `probe-rs run` properly.
- How to troubleshoot
- How to enable logs
- What are common errors
- Can we also add hints in our error messages
- Clean up docs a lot and explain in more detail.
- Add a searchable list of provided targets with information about each target.

You can install the latest build of zola by running `cargo install --git https://github.com/getzola/zola`. You will need the runtime and development packages for libsass installed on your OS.
## Development

## Deployment
[Install](https://deno.land/[email protected]/getting_started/installation) deno
which is the JS runtime to generate all webpage docs.

To deploy the webpage we use Docker.
The container can be built with `scripts/build_docker.sh` and run locally with `scripts/run_docker.sh`.
To deploy the container for the `probe.rs` domain, please contact @Yatekii or @tiwalun.
You need a GitHub API token with repository read access to circumvent API rate
limiting. Store it in the `GITHUB_TOKEN` environment variable for the deno
process to pick up. Run `deno task serve` in this repository root.
116 changes: 116 additions & 0 deletions _config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
import lume from "lume/mod.ts";
import jsx from "lume/plugins/jsx.ts";
import vento from "lume/plugins/vento.ts";
import attributes from "lume/plugins/attributes.ts";
import base_path from "lume/plugins/base_path.ts";
import code_highlight from "lume/plugins/code_highlight.ts";
import date from "lume/plugins/date.ts";
import esbuild from "lume/plugins/esbuild.ts";
import eta from "lume/plugins/eta.ts";
import feed from "lume/plugins/feed.ts";
import filter_pages from "lume/plugins/filter_pages.ts";
import inline from "lume/plugins/inline.ts";
import mdx from "lume/plugins/mdx.ts";
import picture from "lume/plugins/picture.ts";
import imagick from "lume/plugins/imagick.ts";
import sass from "lume/plugins/sass.ts";
import source_maps from "lume/plugins/source_maps.ts";
import svgo from "lume/plugins/svgo.ts";
import toc from "https://deno.land/x/[email protected]/toc/mod.ts";
import readingTime from "https://raw.githubusercontent.com/lumeland/experimental-plugins/main/reading_time/mod.ts";
import { Page } from "lume/core.ts";

const markdown = {
plugins: [toc],
keepDefaultPlugins: true,
};

const site = lume(
{
location: new URL("https://probe.rs"),
dest: "./target",
src: "./src",
server: {
// open: true,
},
},
{ markdown }
);

site.copy("static", ".");
site.copy([".gif"]);
site.use(jsx());
site.use(vento());
site.use(attributes());
site.use(base_path());
site.use(code_highlight());
site.use(date());
site.use(esbuild());
site.use(eta());
site.use(feed());
site.use(filter_pages());
site.use(inline());
site.use(mdx());
site.use(picture());
site.use(imagick());
site.use(sass());
site.use(source_maps());
site.use(svgo());
site.use(readingTime());
site
.scopedUpdates((path) => path.endsWith(".png") || path.endsWith(".jpg"))
.filter("slice", (arr, length) => arr.slice(0, length))
.process([".html"], (page) => {
const doc = page.document!;
const blocks = doc.querySelectorAll("probe-rs-code");

blocks.forEach((block, i) => {
const pres = (block as unknown as HTMLElement).querySelectorAll(
":scope > pre"
);

const menu = doc.createElement("ul");
menu.setAttribute("role", "tablist");
menu.setAttribute("aria-label", "Code Tabs");
menu.classList.add("probe-rs-code-menu");

pres.forEach((pre, j) => {
const title = pre.querySelector("code")!.getAttribute("title")!;

const li = doc.createElement("li");
li.setAttribute("role", "presentation");

const button = doc.createElement("button");
button.setAttribute("role", "tab");
button.setAttribute("aria-selected", j === 0 ? true : false);
button.setAttribute("aria-controls", `panel-${i + 1}-${j + 1}`);
button.setAttribute("id", `tab-${i + 1}-${j + 1}`);
button.setAttribute("tabindex", j === 0 ? 0 : -1);
button.innerText = title;
button.classList.add("probe-rs-code-tab");

if (j > 0) {
pre.setAttribute("hidden", "true");
} else {
button.classList.add("is-active");
}

pre.setAttribute("role", "tabpanel");
pre.setAttribute("aria-labelledby", `tab-${i + 1}-${j + 1}`);
pre.setAttribute("id", `panel-${i + 1}-${j + 1}`);
pre.setAttribute("tabindex", "0");

li.append(button);
menu.appendChild(li);
});

(block as unknown as HTMLElement).prepend(menu as unknown as Node);
});
})
.preprocess([".md"], (page: Page) => {
page.data.excerpt ??= (page.data.content as string).split(
/<!--\s*more\s*-->/i,
)[0];
});

export default site;
70 changes: 0 additions & 70 deletions config.toml

This file was deleted.

69 changes: 0 additions & 69 deletions content/_index.md

This file was deleted.

Loading

0 comments on commit 9558a89

Please sign in to comment.