{data.title}
++
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index eb07c37b..ed58b44e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 diff --git a/.gitignore b/.gitignore index 0c98ec09..fb6edcb8 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/.nvmrc b/.nvmrc index b6a7d89c..2bd5a0a9 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -16 +22 diff --git a/README.md b/README.md index 7f59cda9..0730f7ef 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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 `npm run stdlib doc` 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! + ### 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 --- @@ -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. diff --git a/astro.config.mjs b/astro.config.mjs new file mode 100644 index 00000000..87f97ee7 --- /dev/null +++ b/astro.config.mjs @@ -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", "**/*.gro"], + 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"}] + } + }, +}); diff --git a/blog_config.yml b/blog_config.yml deleted file mode 100644 index 1de6bf50..00000000 --- a/blog_config.yml +++ /dev/null @@ -1,106 +0,0 @@ -# Hexo Configuration -## Docs: https://hexo.io/docs/configuration.html -## Source: https://github.com/hexojs/hexo/ - -# Site -title: Grain Documentation -subtitle: -description: -author: Oscar Spencer -language: -timezone: - -# URL -## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/' -url: https://grain-lang.org/blog -root: /blog/ -permalink: :year/:month/:day/:title/ -permalink_defaults: - -# RSS Feed -feed: - enable: true - type: - - atom - - rss2 - path: - - atom.xml - - rss2.xml - limit: 20 - hub: - content: true - content_limit: 140 - content_limit_delim: " " - order_by: -date - icon: ./../favicon/favicon.ico - autodiscovery: true - template: -# Directory -source_dir: src_blog -public_dir: blog -tag_dir: tags -archive_dir: archives -category_dir: categories -code_dir: downloads/code -i18n_dir: :lang -pretty_urls: - trailing_html: false - -project: blog -# Writing -new_post_name: :title.md # File name of new posts -default_layout: post -titlecase: false # Transform title into titlecase -external_link: true # Open external links in new tab -filename_case: 0 -render_drafts: false -post_asset_folder: false -relative_link: false -future: true -highlight: - enable: false - -# Home page setting -# path: Root path for your blogs index page. (default = '') -# per_page: Posts displayed per page. (0 = disable pagination) -# order_by: Posts order. (Order by date descending by default) -index_generator: - path: "" - per_page: 10 - order_by: -date - -# Category & Tag -default_category: uncategorized -category_map: -tag_map: - -# Date / Time format -## Hexo uses Moment.js to parse and display date -## You can customize the date format as defined in -## http://momentjs.com/docs/#/displaying/format/ -date_format: YYYY-MM-DD -time_format: HH:mm:ss - -# Pagination -## Set per_page to 0 to disable pagination -per_page: 10 -pagination_dir: page - -# Extensions -## Plugins: https://hexo.io/plugins/ -## Themes: https://hexo.io/themes/ -theme: grain - -# Deployment -## Docs: https://hexo.io/docs/deployment.html -deploy: - type: - -server: - serveStatic: - extensions: - - html - -marked: - gfm: true - breaks: false diff --git a/docs_config.yml b/docs_config.yml deleted file mode 100644 index 3f1b8058..00000000 --- a/docs_config.yml +++ /dev/null @@ -1,167 +0,0 @@ -# Hexo Configuration -## Docs: https://hexo.io/docs/configuration.html -## Source: https://github.com/hexojs/hexo/ - -# Site -title: Grain Documentation -subtitle: -description: -author: Oscar Spencer -language: -timezone: - -# URL -## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/' -url: https://grain-lang.org/docs -root: /docs/ -permalink: :year/:month/:day/:title/ -permalink_defaults: - -# Directory -source_dir: src -public_dir: docs -tag_dir: tags -archive_dir: archives -category_dir: categories -code_dir: downloads/code -i18n_dir: :lang -pretty_urls: - trailing_html: false - -project: docs -sidebar_title: The Grain Docs -docs_groups: - null: - - index - - getting_grain - - editor_setup - The Guide: - - guide/hello_world - - guide/basics - - guide/conditionals - - guide/functions - - guide/mutation - - guide/loops - - guide/collections_and_libraries - - guide/data_types - - guide/pattern_matching - - guide/modules - The Docs: - - intro - - builtin_types - - tooling/grain_cli - - tooling/building_for_production - - tooling/graindoc - Standard Library: - - stdlib/pervasives - - stdlib/array - - stdlib/bigint - - stdlib/buffer - - stdlib/bytes - - stdlib/char - - stdlib/exception - - stdlib/float32 - - stdlib/float64 - - stdlib/hash - - stdlib/immutablearray - - stdlib/immutablemap - - stdlib/immutablepriorityqueue - - stdlib/immutableset - - stdlib/int8 - - stdlib/int16 - - stdlib/int32 - - stdlib/int64 - - stdlib/json - - stdlib/list - - stdlib/map - - stdlib/marshal - - stdlib/number - - stdlib/option - - stdlib/path - - stdlib/priorityqueue - - stdlib/queue - - stdlib/random - - stdlib/range - - stdlib/rational - - stdlib/regex - - stdlib/result - - stdlib/set - - stdlib/stack - - stdlib/string - - stdlib/uint8 - - stdlib/uint16 - - stdlib/uint32 - - stdlib/uint64 - - stdlib/wasi/file - - stdlib/wasi/process - - stdlib/wasi/random - - stdlib/wasi/time - # TODO: Re-enable when docs are more mature - # Language Constructs: - # - constructs/bindings - # - constructs/numbers - # - constructs/booleans - # - constructs/strings - # - constructs/tuples - # - constructs/functions - # - constructs/conditionals - # - constructs/types - # - constructs/pattern_matching - # - constructs/boxes -# Writing -new_post_name: :title.md # File name of new posts -default_layout: post -titlecase: false # Transform title into titlecase -external_link: true # Open external links in new tab -filename_case: 0 -render_drafts: false -post_asset_folder: false -relative_link: false -future: true -highlight: - enable: false - -# Home page setting -# path: Root path for your blogs index page. (default = '') -# per_page: Posts displayed per page. (0 = disable pagination) -# order_by: Posts order. (Order by date descending by default) -index_generator: - path: "" - per_page: 10 - order_by: -date - -# Category & Tag -default_category: uncategorized -category_map: -tag_map: - -# Date / Time format -## Hexo uses Moment.js to parse and display date -## You can customize the date format as defined in -## http://momentjs.com/docs/#/displaying/format/ -date_format: YYYY-MM-DD -time_format: HH:mm:ss - -# Pagination -## Set per_page to 0 to disable pagination -per_page: 10 -pagination_dir: page - -# Extensions -## Plugins: https://hexo.io/plugins/ -## Themes: https://hexo.io/themes/ -theme: grain - -# Deployment -## Docs: https://hexo.io/docs/deployment.html -deploy: - type: - -server: - serveStatic: - extensions: - - html - -marked: - gfm: true - breaks: false diff --git a/favicon/apple-touch-icon-114x114.png b/favicon/apple-touch-icon-114x114.png deleted file mode 100644 index cd62214f..00000000 Binary files a/favicon/apple-touch-icon-114x114.png and /dev/null differ diff --git a/favicon/apple-touch-icon-120x120.png b/favicon/apple-touch-icon-120x120.png deleted file mode 100644 index 684d5546..00000000 Binary files a/favicon/apple-touch-icon-120x120.png and /dev/null differ diff --git a/favicon/apple-touch-icon-144x144.png b/favicon/apple-touch-icon-144x144.png deleted file mode 100644 index 9871b32b..00000000 Binary files a/favicon/apple-touch-icon-144x144.png and /dev/null differ diff --git a/favicon/apple-touch-icon-152x152.png b/favicon/apple-touch-icon-152x152.png deleted file mode 100644 index 12f61e5f..00000000 Binary files a/favicon/apple-touch-icon-152x152.png and /dev/null differ diff --git a/favicon/apple-touch-icon-57x57.png b/favicon/apple-touch-icon-57x57.png deleted file mode 100644 index e0933a6b..00000000 Binary files a/favicon/apple-touch-icon-57x57.png and /dev/null differ diff --git a/favicon/apple-touch-icon-60x60.png b/favicon/apple-touch-icon-60x60.png deleted file mode 100644 index 44096e6a..00000000 Binary files a/favicon/apple-touch-icon-60x60.png and /dev/null differ diff --git a/favicon/apple-touch-icon-72x72.png b/favicon/apple-touch-icon-72x72.png deleted file mode 100644 index 0f77e959..00000000 Binary files a/favicon/apple-touch-icon-72x72.png and /dev/null differ diff --git a/favicon/apple-touch-icon-76x76.png b/favicon/apple-touch-icon-76x76.png deleted file mode 100644 index 14f836a9..00000000 Binary files a/favicon/apple-touch-icon-76x76.png and /dev/null differ diff --git a/favicon/code.txt b/favicon/code.txt deleted file mode 100644 index 9940c02e..00000000 --- a/favicon/code.txt +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/favicon/favicon-128.png b/favicon/favicon-128.png deleted file mode 100644 index 2fcff94b..00000000 Binary files a/favicon/favicon-128.png and /dev/null differ diff --git a/favicon/favicon-16x16.png b/favicon/favicon-16x16.png deleted file mode 100644 index da704eda..00000000 Binary files a/favicon/favicon-16x16.png and /dev/null differ diff --git a/favicon/favicon-196x196.png b/favicon/favicon-196x196.png deleted file mode 100644 index 5db07561..00000000 Binary files a/favicon/favicon-196x196.png and /dev/null differ diff --git a/favicon/favicon-32x32.png b/favicon/favicon-32x32.png deleted file mode 100644 index d16d16ab..00000000 Binary files a/favicon/favicon-32x32.png and /dev/null differ diff --git a/favicon/favicon-96x96.png b/favicon/favicon-96x96.png deleted file mode 100644 index 5c9cfff6..00000000 Binary files a/favicon/favicon-96x96.png and /dev/null differ diff --git a/favicon/favicon.ico b/favicon/favicon.ico deleted file mode 100644 index 58492acb..00000000 Binary files a/favicon/favicon.ico and /dev/null differ diff --git a/favicon/mstile-144x144.png b/favicon/mstile-144x144.png deleted file mode 100644 index 9871b32b..00000000 Binary files a/favicon/mstile-144x144.png and /dev/null differ diff --git a/favicon/mstile-150x150.png b/favicon/mstile-150x150.png deleted file mode 100644 index 2d74b5c3..00000000 Binary files a/favicon/mstile-150x150.png and /dev/null differ diff --git a/favicon/mstile-310x150.png b/favicon/mstile-310x150.png deleted file mode 100644 index 490d942d..00000000 Binary files a/favicon/mstile-310x150.png and /dev/null differ diff --git a/favicon/mstile-310x310.png b/favicon/mstile-310x310.png deleted file mode 100644 index 68eec3e6..00000000 Binary files a/favicon/mstile-310x310.png and /dev/null differ diff --git a/favicon/mstile-70x70.png b/favicon/mstile-70x70.png deleted file mode 100644 index 2fcff94b..00000000 Binary files a/favicon/mstile-70x70.png and /dev/null differ diff --git a/images/grain_logo_white.svg b/images/grain_logo_white.svg deleted file mode 100644 index 47f8a530..00000000 --- a/images/grain_logo_white.svg +++ /dev/null @@ -1,11 +0,0 @@ - diff --git a/images/grain_shorthand_color.svg b/images/grain_shorthand_color.svg deleted file mode 100644 index 6af8b58b..00000000 --- a/images/grain_shorthand_color.svg +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/images/grain_shorthand_white.svg b/images/grain_shorthand_white.svg deleted file mode 100644 index cbe332c3..00000000 --- a/images/grain_shorthand_white.svg +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/index.html b/index.html deleted file mode 100644 index b6538611..00000000 --- a/index.html +++ /dev/null @@ -1,144 +0,0 @@ - -
- -- Grain aims to modernize innovative features from functional and academic programming languages and bring them to the masses. Many languages have had wonderful ideas, but they have ultimately been dismissed as esoteric or too difficult to learn and, consequently, have struggled to rally a large community around them. Grain hopes to bring new life to these ideas and present them in an accessible form that’s easy to use and understand. -
-${lines.join("")}{entry.data.author}
++ {entry.data.date.toLocaleDateString(undefined, { month: "short", day: "numeric", year: "numeric" })} +
+Published
+{entry.data.date.toLocaleDateString(undefined, { month: "short", day: "numeric", year: "numeric" })}
+{entry.data.subtitle}
+Grain
+ Playground
+
+ ))}
+ The high-level programming language for WebAssembly
+
+
+ 🌾 = Noteworthy contributors to the project. +
++ Meet Grain's co-creator, Oscar. In 2017, Oscar, excited about WebAssembly's + possibilities, co-created Grain, an easy-to-use, flexible but functional + language that made adoption of WebAssembly simple for the world's + developers. +
+ ++ Known for his problem solving and optimism, Oscar is a Principal Engineer + at F5 NGINX. +
+ ++ Oscar specializes in compilers, language design, OCaml, and functional + programming. When he's not working, find him on Discord or mulling over the + next big challenge. +
+ ++ Who he admires: Guido van Rossum, creator of Python, a language that + developers adore, with a welcoming community. +
++ Philip is Grain's co-creator. Resourceful and analytical, he works to + implement features which impact the end-user experience to enhance Grain's + ease of use, familiarity, and accessibility. +
+ ++ Philip is the Senior Research Engineer at Basis Technology, where he + investigates practical applications of deep learning technologies for use + in text analytics. +
+ ++ Philip is an avid runner, and especially enjoys his route along the local + river. Most afternoons, you can find Philip in his favorite neighborhood + café, sipping a coffee and working away. +
+ ++ Drink of choice: double espresso, Ethiopian single-origin. +
++ Blaine is a freelance open source developer and founder of Lead Gumshoe, an + open source consulting company. Blaine specializes in helping organizations + understand and use open source software. +
+ ++ Pragmatic with a strong work ethic, Blaine brings developer experience, + tooling, language design and grant writing experience to Grain. He was + responsible for providing a single installable binary for users to get + up-and-running quickly. He also streamlined the release process so + everything is released with 1-click. He also does the arduous work of + making Grain work on Windows. +
+ ++ When Blaine's not working, he likes to build Legos and play trading card + games. He was even the final world champion for the no-longer-produced + MetaX trading card game. +
++ Supportive and bold, Marcus is a champion for building teams who develop + self-sufficiently. His goal for Grain is simple: a language with easy step + up, easy development, and a full set of tooling essential for today's + developers. +
+ ++ Marcus was responsible for building Grain's language server that provides + code analysis for code editors. +
+ ++ Currently, Marcus works as the Technical Director at Nittygritty, where he + leads both the technical services part of the company and a software + development team. +
+ ++ On any given Friday night, you can find Marcus drinking a craft beer and + surfing the web. He hasn't found the end yet. +
+ ++ His biggest ask: That you stand to the right on the London Underground + escalators. Seriously. +
++ Driven by a passion for programming languages and WebAssembly, Jake + brings a fresh and dynamic perspective to the Grain core team. His + contributions focus on enhancing the standard library, Jake has played + a key role in building the JSON and Number libraries, refining + documentation, and supporting language server development. On occasion, + he also contributes to the compiler, further expanding his expertise. +
+ ++ Currently studying type checking and compiler development, Jake blends + his curiosity for programming languages with hands-on contributions to + Grain. Outside of tech, he enjoys exploring the outdoors and engineering. +
+ ++ Jake is constantly exploring ways to push the boundaries of what's + possible with programming languages and is always eager to learn new + things and contribute to the advancement of technology. +
++ Alex understands how important having a great programming language is for + building software and is motivated by the goal of making Grain an + exceptional language that is easy and enjoyable to build with. +
+ ++ Alex is currently a software engineer at SpaceX and builds software for + Starlink kit order fulfillment and other logistics verticals. +
+ ++ Outside of tech, Alex enjoys gaming, building mechanical keyboards, and + heavy metal music. +
++ Designed to be a practical functional language, Grain makes + WebAssembly simple for the world's developers solving everyday + problems. +
++ Grain is an easy-to-use, high-level programming language specifically + created for WebAssembly. Designed to be a practical functional language, + Grain makes WebAssembly simple for the world's developers solving + everyday problems. +
+
+
Sign up for farm-to-inbox developer news
+You can unsubscribe at any time. Read our privacy policy.
++ Our bottom line: + Help you reap the benefits of Grain and WebAssembly, with an + effortless language, great developer experience, broad application + potential, and an awesome community. +
++ We rely on volunteer contributors and sponsors to sustain the project. + Development of the Grain programming language is financially + supported by our GitHub Sponsors supporters, corporate sponsors, + and Open Collective donors. +
++ Our current contributors come from a wide variety of experiences and + backgrounds, which adds significant value to how we approach + developer experience. +
+ Sponsor Us → ++ Contributors come in many forms—code contributors, documentation + writers, bug finders, community organizers, language evangelists, and + more. Whether you want to dive into some code, write some docs, + give us your ideas, or just come hang out, we've got a place for you. +
++ Connect with us on Discord! + We'll walk through contributor opportunities with you, and we're even + glad to do a pair programming session to get you up to speed. We'll go + over how to get involved and teach you anything you need to know, even + if you've never touched a compiler or worked on a programming language. +
+{output}
+ {/if}
+ nextnextnextnextnextnextnextnextnextnextnextnextnextnextnextnextnextnextnextnextnextnextnextnextnextnextnextnextnextnextnextnextnextnextnext0.5.40.5.40.5.40.5.40.5.40.5.40.5.40.5.40.5.40.5.40.5.40.5.40.5.40.5.40.5.40.5.40.5.40.5.40.5.40.5.30.5.40.5.30.5.30.5.30.5.30.5.30.5.30.5.30.5.40.5.40.5.40.5.40.5.40.5.40.5.40.5.40.5.40.5.40.5.40.5.40.5.40.5.40.5.40.5.40.5.40.5.40.5.4<%- item.subtitle %>
- - - <% }); %> -<%- page.subtitle %>
- -