Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Website V2 #389

Open
wants to merge 37 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
c37b6db
gut hexo
ospencer Mar 29, 2023
7f8e740
bootstrap next
ospencer Mar 29, 2023
d533fac
add build config for this branch
ospencer Mar 29, 2023
a5e10ea
bootstrap tailwind
ospencer Mar 29, 2023
1a1389e
nav
ospencer Mar 31, 2023
32b001f
hero
ospencer Apr 1, 2023
cbd72c0
wip
ospencer Apr 25, 2023
6b6766d
Migrate to Astro, finish most content
alex-snezhko May 6, 2024
944a7af
Dark mode, responsive, search progress
alex-snezhko May 12, 2024
a4e99d4
More responsive design progress
alex-snezhko May 12, 2024
a572dd6
Styling, responsive layout changes
alex-snezhko May 20, 2024
7dea987
Fixed most content styling, misc styling tweaks
alex-snezhko Jul 15, 2024
f14819e
Begin playground
alex-snezhko Aug 9, 2024
36e75cd
Playground progress
alex-snezhko Aug 12, 2024
71b9739
Playground fairly complete
alex-snezhko Oct 12, 2024
5dbec17
Cleanup
alex-snezhko Oct 13, 2024
32dd80b
Address some review feedback
alex-snezhko Oct 14, 2024
e974bc8
Docsearch
alex-snezhko Oct 27, 2024
aac484a
Styling improvements
alex-snezhko Nov 1, 2024
2b668e6
Addressing feedback
alex-snezhko Nov 3, 2024
9797834
Font, styling improvements
alex-snezhko Nov 5, 2024
5efa362
Contributors view
alex-snezhko Nov 16, 2024
c0f074d
Styling tweaks, privacy policy
alex-snezhko Nov 19, 2024
9dd281c
Extract astro folder to top level
alex-snezhko Nov 20, 2024
c826fa1
CI build fix
alex-snezhko Nov 22, 2024
26c1b58
Move grainc location
alex-snezhko Nov 28, 2024
aae4a33
CSS tweaks for mobile
alex-snezhko Nov 30, 2024
9814b9e
Mailing list unsubscribe
alex-snezhko Dec 7, 2024
24076fc
Upgrade to Astro 5
alex-snezhko Dec 7, 2024
d81d440
Misc feedback
alex-snezhko Dec 13, 2024
26b76e9
Remove tables on mobile
alex-snezhko Dec 15, 2024
7ff7662
Address most review feedback
alex-snezhko Jan 5, 2025
30bd40f
Improve playground action buttons on mobile
alex-snezhko Jan 12, 2025
4b2bcc0
RSS Feed
alex-snezhko Jan 12, 2025
df7209a
Update Site ID env variable
alex-snezhko Jan 13, 2025
3e1d5d3
Social media links, fix rss link
alex-snezhko Jan 26, 2025
c16caef
Address review feedback
alex-snezhko Feb 3, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ jobs:

- name: Generate stdlib docs
run: |
grain doc grain/stdlib -o src/stdlib --current-version=$(grain -v)
grain doc grain/stdlib -o src/content/docs/stdlib --current-version=$(grain -v)

- name: Commit updates
run: |
git add src/getting_grain.md
git add src/stdlib/
git add src/content/docs/stdlib/
git commit -m 'chore: Update website for ${{ github.event.inputs.tag }}'

- name: Push updates
Expand Down
40 changes: 30 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,32 @@
.DS_Store
Thumbs.db
db.json
*.log
# build output
dist/

# generated types
.astro/

# dependencies
node_modules/
.deploy*/
_multiconfig.yml
/docs
/guide
/blog
/try

# logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*

# environment variables
.env
.env.production

# macOS-specific files
.DS_Store

# jetbrains setting folder
.idea/

.vscode/

/*.gr.wasm
contributors.json

# Local Netlify folder
.netlify
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16
22
21 changes: 7 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Documentation for the Grain programming language at [grain-lang.org](https://gra

## About

This documentation site is a [Hexo](https://hexo.io/) site. All of the docs are generated from Markdown files, and Hexo builds a static website that is hosted on Netlify.
This documentation site is an [Astro](https://astro.build/) site. All of the docs are generated from Markdown files, and the static bundle generated by Astro is hosted on Netlify.

## Contributing

Expand All @@ -34,9 +34,11 @@ git pull --recurse-submodules

To make a change to a document, edit the corresponding Markdown file in [src](src). The file path matches the URL path after `/docs`, but if you have trouble finding the page you're looking for, you can click the "Edit on GitHub" button at the top of page on the website.

Please note that standard library documentation is auto-generated from our standard library source with our documentation tool `grain doc`. If you'd like to make an edit to the standard library docs please do so in the corresponding source file in the main compiler monorepo found [here](https://github.com/grain-lang/grain/tree/main/stdlib). After editing the source file, you can run `grain doc stdlib -o stdlib --current-version=$(grain -v)` from the project root directory to generate the `.md` docs. The changes will be reflected on the website the next time we deploy changes for the next release!
alex-snezhko marked this conversation as resolved.
Show resolved Hide resolved

### Adding a New Document

Create your new Markdown file in `src`. You'll also need to update [docs_config.yml](docs_config.yml) to include your new page in the sidebar. Each document starts with some front-matter, which is a bit of yml/json that is given to the renderer. For now, this only includes the title of the page. Since the title of the page is an `h1`, headers in your document should begin at level 2:
Create your new Markdown file in the desired location within `src/content/docs`. Each document starts with some front-matter, which is a bit of yaml that is given to the renderer. Since the title of the page is an `h1`, headers in your document should begin at level 2:

```markdown
---
Expand All @@ -48,20 +50,11 @@ title: Some Title of Some Topic

### Previewing the Site

Once a PR is created, Netlify will create a preview site and comment on the PR with a link. If you'd like to view your changes locally,

For the docs, run:

```sh
npm install
npm run start-docs
```

For the blog, run:
Once a PR is created, Netlify will create a preview site and comment on the PR with a link. If you'd like to view your changes locally (Node v18+ required):

```sh
npm install
npm run start-blog
npm run dev
```

This will install all build dependencies and serve the website on port 3000.
This will install all build dependencies and serve the website on port 4321.
84 changes: 84 additions & 0 deletions astro.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
import { defineConfig } from "astro/config";
import tailwind from "@astrojs/tailwind";
import svelte from "@astrojs/svelte";
import rehypeAutolinkHeadings from "rehype-autolink-headings";
import rehypeSlug from "rehype-slug";
import path from "node:path";
import { createRequire } from "node:module";
import * as fs from "node:fs";
import rehypeContentIntroTextTransformer from "./src/rehype/rehype-content-intro-text-transformer";
import rehypeAutolinkHeadingsConfig from "./src/rehype/rehype-autolink-headings-config";
import rehypeTableWrapper from "./src/rehype/rehype-table-wrapper";

const require = createRequire(import.meta.url);

const grainLang = JSON.parse(fs.readFileSync("./grain-language-server/editor-extensions/vscode/syntaxes/grain.json"));
const theme = JSON.parse(fs.readFileSync("./themes/github-dark-modified-lighter.json"));

// https://astro.build/config
export default defineConfig({
site: "https://grain-lang.org",
vite: {
// We want to include wasm files as raw data and then we glob for their urls
assetsInclude: ["**/*.wasm"],
alex-snezhko marked this conversation as resolved.
Show resolved Hide resolved
resolve: {
dedupe: ["buffer"],
alias: {
path: require.resolve("path-browserify"),
stream: require.resolve("readable-stream/lib/ours/browser.js"),
// This tricks the import into allowing us to use globs with `import.meta.glob`
"@grain/stdlib": path.dirname(require.resolve("@grain/stdlib")),
},
},
define: {
"process.platform": JSON.stringify("posix"),
"process.env.NODE_DEBUG": "false",
},
optimizeDeps: {
esbuildOptions: {
target: "esnext",
define: {
global: "globalThis",
process: JSON.stringify({}),
"process.env": JSON.stringify({}),
"process.platform": JSON.stringify("posix"),
"process.env.NODE_DEBUG": "false",
},
},
},
build: {
target: "esnext",
}
},

integrations: [tailwind(), svelte()],

redirects: {
"/docs": "/docs/intro",
"/docs/guide": "/docs/guide/basics"
},

markdown: {
rehypePlugins: [
rehypeSlug,
[
rehypeAutolinkHeadings,
rehypeAutolinkHeadingsConfig,
],
rehypeContentIntroTextTransformer,
rehypeTableWrapper,
],
shikiConfig: {
theme: theme,
transformers: [
{
code(node) {
// Hack to distinguish block code from inline code in tailwind-typography
node.properties["data-block"] = "true";
}
}
],
langs: [{...grainLang, name: "grain"}]
}
},
});
106 changes: 0 additions & 106 deletions blog_config.yml

This file was deleted.

Loading