+++ /dev/null
-[metadata]
-name=onyxlang-io
-description=The onyxlang.io website
-url=https://onyxlang.io
-author=Brendan Hansen
-version=0.0.1
-
-[config]
-lib_source_directory=./lib
-lib_bin_directory=./bin
-run_cmd=onyx run build
-debug_cmd=onyx run --debug build
-
-[native_library]
-
-[dependencies]
-git://onyxlang.io/repo/http-server=0.2.23
-git://onyxlang.io/repo/otmp=0.0.25
-
-[dependency_folders]
-git://onyxlang.io/repo/http-server=http-server
-git://onyxlang.io/repo/otmp=otmp
-git://onyxlang.io/repo/base64=base64
-
--- /dev/null
+package {
+ name "onyxlang-io"
+ author "Brendan Hansen"
+ url "https://onyxlang.io"
+ description "The onyxlang.io website"
+ version "0.0.1"
+}
+
+config {
+ dependency_source_path "./lib"
+ dependency_binary_path "./bin"
+}
+
+dependencies {
+ http-server "0.2.24" git="git://onyxlang.io/repo/http-server"
+ otmp "0.0.26" git="git://onyxlang.io/repo/otmp"
+}
+
(req: &Req, res: &Res) => res->render("pages/docs/install", null);
@route.{.GET, "/docs/setup"}
-(req: &Req, res: &Res) => res->render("pages/docs/setup", null);
+(req: &Req, res: &Res) => res->render("pages/docs/env_setup", null);
+
+@route.{.GET, "/docs/getting_started"}
+(req: &Req, res: &Res) => res->render("pages/docs/getting_started", null);
Article :: struct { name, description, path, date: str }
<div class="container">
<h2>Getting Started</h2>
<p>
- Install Onyx locally on your system or use it in your browser.
+ Install Onyx locally on your system and write your first program.
</p>
<p>
+ <a class="link-button" href="/docs/getting_started">Getting Started</a>
<a class="link-button" href="/docs/install">Install</a>
<a class="link-button" href="/docs/setup">Environment Setup</a>
- <a class="link-button" href="/playground/">Playground</a>
</p>
</div>
--- /dev/null
+{{block "title"}}Onyx Environment Setup{{endblock}}
+
+{{ let navbar_page = "docs" }}
+
+{{ block "page_content" }}
+
+<div class="container header">
+ <h1>Setting Up Your Environment for Onyx</h1>
+
+ <p>The following sections will help set up an environment for you to program Onyx effectively.</p>
+
+ <p>
+ <a class="link-button" href="#vscode">VS Code</a>
+ <a class="link-button" href="#vim">Vim / Neovim</a>
+ <a class="link-button" href="#sublime-text">Sublime text</a>
+ <a class="link-button" href="#emacs">Emacs</a>
+ <a class="link-button" href="#lsp">Language Server</a>
+ </p>
+
+ <p style="opacity: 0.5; font-size: 0.75em">
+ (If you don't see your favorite editor here, consider making a <a href="https://github.com/onyx-lang/onyx/issues">issue</a>!)
+ </p>
+</div>
+
+
+<div class="container light" id="vscode">
+ <h2>Visual Studio Code</h2>
+</div>
+<div class="container">
+ <p>
+ <a class="link-button" href="https://marketplace.visualstudio.com/items?itemName=onyxlang.onyxlang">VS Code Extension</a>
+ </p>
+
+ <p>
+ Onyx has an official published extension on the Visual Studio Marketplace.
+ Search "Onyx Programming Language" in the extensions panel or install from the marketplace.
+ </p>
+
+ <p>Alternatively, you can follow these steps to install the extension from the VSIX file included in the Onyx distribution.</p>
+ <ol>
+ <li>Hit "Control+Shift+P" on Windows/Linux, or "Command+Shift+P" on MacOS.</li>
+ <li>Search for and select "Extensions: Install from VSIX".</li>
+ <li><p>Go to your <code>ONYX_PATH</code> and select the <code>.vsix</code> file in the <code>misc</code> folder.</p></li>
+ <li>Restart VS Code.</li>
+ </ol>
+
+ <p>This extension does have support for the <code>onyx lsp</code>, assuming that is <a href="#lsp">setup</a>.
+</div>
+
+<div class="container light" id="vim">
+ <h2>Vim / Neovim</h2>
+</div>
+<div class="container">
+ <p>
+ <a class="link-button" href="https://github.com/onyx-lang/onyx.vim">Vim Plugin</a>
+ </p>
+
+ <p>
+ Follow the instructions on the <a href="https://github.com/onyx-lang/onyx.vim">onyx.vim</a> GitHub repo.
+ </p>
+
+ <p>
+ Note, that this extension currently does not setup the LSP.
+ That must be done separately.
+ </p>
+</div>
+
+
+<div class="container light" id="sublime-text">
+ <h2>Sublime Text</h2>
+</div>
+<div class="container">
+ <p>
+ Currently, Onyx does not have a published package on Sublime Text's Package Control, but like VS Code, you are able to install it manually.
+ </p>
+ <p>
+ In the <code>misc</code> folder of your installation, there is a file called <code>onyx.sublime-syntax</code>. Simply copy this into the <code>Packages/User</code> folder for Sublime Text. See more details <a href="https://www.sublimetext.com/docs/packages.html">here</a>.
+ </p>
+</div>
+
+<div class="container light" id="emacs">
+ <h2>Emacs</h2>
+</div>
+<div class="container">
+ <p>
+ Currently, Onyx does not have a published package for Emacs.
+ </p>
+
+ <p>
+ However, in the <code>misc</code> folder, there is an Emacs Lisp file that provides an <code>onyx-mode</code>.
+ You should be able to load it into your Emacs config and enable <code>onyx-mode</code> to get syntax highlighting.
+ </p>
+</div>
+
+<div class="container light" id="lsp">
+ <h2>Language Server</h2>
+</div>
+<div class="container">
+ <p>
+ If you are unfamiliar, a <em>Language Server</em> abstracts the tooling and language specific functionality out of editors and into a reusable component.
+ This way, it is easier to develop in-editor functionality across multiple editors, as the same work does not need to be replicated for each supported editor.
+ </p>
+
+ <h3>Installing the Language Server</h3>
+ <p>On Linux, MacOS, or the Windows Subsystem for Linux, run the following commands.</p>
+ <pre class="hljs"><code class="language-sh"># Clone the Onyx Language Server
+git clone https://github.com/onyx-lang/onyx-lsp
+cd onyx-lsp/run_tree
+# Make the install script executable
+chmod +x ./install
+# Install the LSP
+./install</code></pre>
+
+ <h3>Visual Studio Code</h3>
+ <p>Installing the extension automatically enables the language server in VS Code.</p>
+
+ <h3>Neovim</h3>
+ <p>To use the language server in NeoVim, you need to have <a href="https://github.com/neovim/nvim-lspconfig">the NeoVim lspconfig package</a> installed.</p>
+ <p>Then, you need the following in your NeoVim configuration somewhere:</p>
+ <pre class="hljs"><code class="language-lua">local lspconfig = require 'lspconfig'
+local configs = require 'lspconfig.configs'
+
+configs.onyx = {
+ default_config = {
+ cmd = { "onyx", "lsp" },
+ filetypes = { "onyx" },
+ root_dir = function(filename)
+ local utils = require "lspconfig.util"
+ return utils.search_ancestors(filename, function(path)
+ if utils.path.is_file(utils.path.join(path, "onyx-lsp.ini")) then
+ return path
+ end
+ end)
+ end;
+ settings = {}
+ }
+}
+
+lspconfig.onyx.setup {
+ on_attach = function(client)
+ print("Onyx LSP started.")
+ end
+}</code></pre>
+
+ <h3>Sublime Text</h3>
+ <p>
+ Install the <code>LSP</code> package, and add the following custom configuration.
+ See more information on <a href="https://lsp.sublimetext.io">the LSP package docs</a>.
+ </p>
+ <pre class="hljs"><code class="language-json">{
+ "clients": {
+ "onyx": {
+ "enabled": true,
+ "command": ["onyx", "lsp"],
+ "selector": "source.onyx"
+ }
+ }
+}</pre></code>
+</div>
+
+{{ endblock }}
+
+{{ extends "pages/normal_page" }}
--- /dev/null
+{{ block "title" }}
+ Getting Started
+{{ endblock }}
+
+{{ block "page_content" }}
+
+<div class="container header">
+ <h1>Getting Started</h1>
+</div>
+
+<div class="container">
+ <p>
+ This short guide will walk you through getting Onyx installed on your system, creating your first project, and running your first program.
+ There are more in-depths guides after this one.
+ </p>
+</div>
+
+<div class="container">
+ <h2>Step 1: Install Onyx</h2>
+ <p>On any Linux, MacOS, or WSL system, run the following command to install Onyx onto your system.</p>
+ <pre class="hljs"><code class="language-sh">sh <(curl https://get.onyxlang.io -sSfL)</code></pre>
+
+ <p>
+ For more details, or how to install on Windows, see the <a href="/docs/install">installation</a> docs.
+ </p>
+</div>
+
+<div class="container">
+ <h2>Step 2: Create an Onyx project</h2>
+
+ <p>
+ <em>This is an optional step, but does set you up to use packages in your project.</em>
+ <em>Learn more about the package manager <a href="/docs/package">here</a>.</em>
+ </p>
+
+ <p>Create a new directory and setup a new project. Optionally project values when prompted.</p>
+ <pre class="hljs"><code class="language-sh">$ mkdir my-onyx-project
+$ cd my-onyx-project
+$ onyx pkg init
+Creating new project manifest in ./onyx-pkg.kdl.
+
+Package name: my-onyx-project
+Package description: My first Onyx project
+Package url:
+Package author: Brendan Hansen
+Package version (0.0.1):</code></pre>
+</div>
+
+<div class="container">
+ <h2>Step 3: Write your first Onyx program</h2>
+ <p>
+ Open your favorite text editor, optionally install <a href="/docs/setup">editor support</a>, and create a new file called <code>main.onyx</code> in this project folder.
+ Write the following code in that file.
+ </p>
+ <pre class="hljs"><code class="language-onyx">use core {printf}
+
+main :: () {
+ printf("Hello, Onyx!\n");
+}</code></pre>
+
+ <p>
+ This code brings in the <code>printf</code> symbol from the core libraries so we can print to the console.
+ Then in the <code>main</code> function, we print "Hello, Onyx!".
+ </p>
+</div>
+
+<div class="container">
+ <h2>Step 4: Run your program!</h2>
+ <p>To run the program our newly created program, we use the following command from within the project folder.</p>
+ <pre class="hljs"><code class="language-onyx">$ onyx run main.onyx
+Hello, Onyx!</code></pre>
+
+ <p>
+ Congratulations! You just wrote your first Onyx program.
+ </p>
+ <p>
+ Now you can <a href="/docs">read the docs</a> and experiment with Onyx in this project.
+ </p>
+</div>
+
+{{ endblock }}
+
+{{ extends "pages/normal_page" }}
\ No newline at end of file
+++ /dev/null
-{{block "title"}}Onyx Environment Setup{{endblock}}
-
-{{ let navbar_page = "docs" }}
-
-{{ block "page_content" }}
-
-<div class="container header">
- <h1>Setting Up Your Environment for Onyx</h1>
-
- <p>The following sections will help set up an environment for you to program Onyx effectively.</p>
-
- <p>
- <a class="link-button" href="#vscode">VS Code</a>
- <a class="link-button" href="#vim">Vim / Neovim</a>
- <a class="link-button" href="#sublime-text">Sublime text</a>
- <a class="link-button" href="#emacs">Emacs</a>
- <a class="link-button" href="#lsp">Language Server</a>
- </p>
-
- <p style="opacity: 0.5; font-size: 0.75em">
- (If you don't see your favorite editor here, consider making a <a href="https://github.com/onyx-lang/onyx/issues">issue</a>!)
- </p>
-</div>
-
-
-<div class="container light" id="vscode">
- <h2>Visual Studio Code</h2>
-</div>
-<div class="container">
- <p>
- <a class="link-button" href="https://marketplace.visualstudio.com/items?itemName=onyxlang.onyxlang">VS Code Extension</a>
- </p>
-
- <p>
- Onyx has an official published extension on the Visual Studio Marketplace.
- Search "Onyx Programming Language" in the extensions panel or install from the marketplace.
- </p>
-
- <p>Alternatively, you can follow these steps to install the extension from the VSIX file included in the Onyx distribution.</p>
- <ol>
- <li>Hit "Control+Shift+P" on Windows/Linux, or "Command+Shift+P" on MacOS.</li>
- <li>Search for and select "Extensions: Install from VSIX".</li>
- <li><p>Go to your <code>ONYX_PATH</code> and select the <code>.vsix</code> file in the <code>misc</code> folder.</p></li>
- <li>Restart VS Code.</li>
- </ol>
-
- <p>This extension does have support for the <code>onyx lsp</code>, assuming that is <a href="#lsp">setup</a>.
-</div>
-
-<div class="container light" id="vim">
- <h2>Vim / Neovim</h2>
-</div>
-<div class="container">
- <p>
- <a class="link-button" href="https://github.com/onyx-lang/onyx.vim">Vim Plugin</a>
- </p>
-
- <p>
- Follow the instructions on the <a href="https://github.com/onyx-lang/onyx.vim">onyx.vim</a> GitHub repo.
- </p>
-
- <p>
- Note, that this extension currently does not setup the LSP.
- That must be done separately.
- </p>
-</div>
-
-
-<div class="container light" id="sublime-text">
- <h2>Sublime Text</h2>
-</div>
-<div class="container">
- <p>
- Currently, Onyx does not have a published package on Sublime Text's Package Control, but like VS Code, you are able to install it manually.
- </p>
- <p>
- In the <code>misc</code> folder of your installation, there is a file called <code>onyx.sublime-syntax</code>. Simply copy this into the <code>Packages/User</code> folder for Sublime Text. See more details <a href="https://www.sublimetext.com/docs/packages.html">here</a>.
- </p>
-</div>
-
-<div class="container light" id="emacs">
- <h2>Emacs</h2>
-</div>
-<div class="container">
- <p>
- Currently, Onyx does not have a published package for Emacs.
- </p>
-
- <p>
- However, in the <code>misc</code> folder, there is an Emacs Lisp file that provides an <code>onyx-mode</code>.
- You should be able to load it into your Emacs config and enable <code>onyx-mode</code> to get syntax highlighting.
- </p>
-</div>
-
-<div class="container light" id="lsp">
- <h2>Language Server</h2>
-</div>
-<div class="container">
- <p>
- If you are unfamiliar, a <em>Language Server</em> abstracts the tooling and language specific functionality out of editors and into a reusable component.
- This way, it is easier to develop in-editor functionality across multiple editors, as the same work does not need to be replicated for each supported editor.
- </p>
-
- <h3>Installing the Language Server</h3>
- <p>On Linux, MacOS, or the Windows Subsystem for Linux, run the following commands.</p>
- <pre class="hljs"><code class="language-sh"># Clone the Onyx Language Server
-git clone https://github.com/onyx-lang/onyx-lsp
-cd onyx-lsp/run_tree
-# Make the install script executable
-chmod +x ./install
-# Install the LSP
-./install</code></pre>
-
- <h3>Visual Studio Code</h3>
- <p>Installing the extension automatically enables the language server in VS Code.</p>
-
- <h3>Neovim</h3>
- <p>To use the language server in NeoVim, you need to have <a href="https://github.com/neovim/nvim-lspconfig">the NeoVim lspconfig package</a> installed.</p>
- <p>Then, you need the following in your NeoVim configuration somewhere:</p>
- <pre class="hljs"><code class="language-lua">local lspconfig = require 'lspconfig'
-local configs = require 'lspconfig.configs'
-
-configs.onyx = {
- default_config = {
- cmd = { "onyx", "lsp" },
- filetypes = { "onyx" },
- root_dir = function(filename)
- local utils = require "lspconfig.util"
- return utils.search_ancestors(filename, function(path)
- if utils.path.is_file(utils.path.join(path, "onyx-lsp.ini")) then
- return path
- end
- end)
- end;
- settings = {}
- }
-}
-
-lspconfig.onyx.setup {
- on_attach = function(client)
- print("Onyx LSP started.")
- end
-}</code></pre>
-
- <h3>Sublime Text</h3>
- <p>
- Install the <code>LSP</code> package, and add the following custom configuration.
- See more information on <a href="https://lsp.sublimetext.io">the LSP package docs</a>.
- </p>
- <pre class="hljs"><code class="language-json">{
- "clients": {
- "onyx": {
- "enabled": true,
- "command": ["onyx", "lsp"],
- "selector": "source.onyx"
- }
- }
-}</pre></code>
-</div>
-
-{{ endblock }}
-
-{{ extends "pages/normal_page" }}