/school-of-rust

Source code for the School of Rust website.

Primary LanguageSCSS

School of Rust

This is the full source code for School of Rust, an educational website with lessons and tutorials to help people learn the Rust programming language.

Rust can be hard to learn, but it is beloved by those who use it (including myself). My goal is to provide a variety of lessons to help you get coding proficiently in Rust.

Let's create fast, secure, and high quality software together!

Whomst?

This website and its content is created by Chevy Ray (:wave: hi!). I am a game developer by day, but when the stars come out I am an online educator, creator of free tools, and probably the internet's most reputed pixel font designer!

Feedback & Contributions

By open sourcing the site, I'm hoping that I can use Github to get continual feedback on the website, and also correct any confusing or incorrect information in any of the articles or tutorials.

At the bottom of every page on the site, you will see something like this:

If you have a suggested change or have found an error, you can also visit the source code for this page, where you can file an issue directly or submit a pull request.

I'm also encouraging readers to join our Discord, both to get assistance and to help others.

How the Website is Built

School of Rust is built with a static site generator called Zola, which is why the source code may look unfamiliar if you were expecting an actual website. Zola is also developed in Rust!

Zola takes this repository's source code and parses it, generating a static website (which is essentially a bunch of pre-baked HTML files). I use a Cloudflare deployment script to run Zola every time the repository updates, which updates the website.

To create content for the site, I create pages in markdown, which Zola then parses and turns into HTML pages using templates I have provided. You probably won't be surprised to learn that the template engine is also coded in Rust.

Because markdown is so simple and easy to write, I am able to write and revise and edit articles and tutorials much more efficiently.

This may seem like a lot of work, but this setup allows me to write content for the site without relying on a complicated content management system like (such as Wordpress or Ghost). Static pages also load very fast, so the website is slim and snappy.

Some Idiosyncrasies

There are a couple tricks (ahem... hacks) I use to give myself a bit more flexibility when writing code tutorials, which I will document here... even if just for myself!

Regular Headers

In articles, I use ## for large headers, and ### for small headers.

a large and a small header

But inside blockquotes, all headers #, ##, ###, and #### are interpreted as different colors of header (rather than size), as demonstrated on the home page:

3 blockquotes with different header colors

They are blue, purple, red, and grey respectively. This allows me to use blockquotes as different types of "info" boxes for different purposes.

For example, if I wanted to briefly mention something tangential in the middle of a tutorial, I might put it in a purple Did You Know? blockquote to indicate that it's not essential to the lesson.

Colored Code Tags

Similar to how headers are treated in blockquotes, code tags also have a special treatment. Surrounding a code tag with emphasis using * will color it yellow, and surrounding it with bold using ** will color it green.

3 differently colored code tags

These are to match two of the main colors in the syntax coloring theme I am using. When I want to reference an item in the code, I'm hoping that by matching their color, I can make it easier for some readers to connect the code and its explanations.