README
Table of contents generated with markdown-toc
the Chinese version: 中文
About rublog
rublog /rʌblɑg/
is a static blog generator written in Rust
, which implements the following functions:
- Convert
markdown
tohtml
via pulldown cmark - Use toml-rs to implement article properties similar to
YAML Front Matter
, see [TOML Front Matter](#TOML Front Matter) - Implement
html
template rendering of Django template language through tera - Currently using web_server to preview the site (consider rewriting)
[View our development plan] (#development plan).
demo DEMO
My blog: https://candlest.github.io/
Install
Currently not packaged, it can be installed from source code.
in the future ;-)
That is, get the source code from release or directly git clone
, and use cargo build --release
to compile. After the compilation is complete, add the binary file to the environment variable and use it from the command line. Here is an example for linux
:
git clone https://github.com/Candlest/rublog.git
cd ./rublog
cargo build --release
sudo cp ./target/release/rublog /usr/bin/rublog
use
Initialize from rublog-template
We can initialize our project from rublog-template, please see its README for details, so I won’t go into details here.
git clone https://github.com/Candlest/rublog-template.git
rublog command
The help list can be obtained through rublog help
or rublog
Build the /public
directory: rublog build
Clean up the /public
directory: rublog clear
Run from the /public
directory: rublog run
Lazy package: clear
, build
, run
in one go: rublog cbr
If you have used
hexo
, thenrublog
is very easy to use, because therublog
command is inspired byhexo
.
Publishing the web page
The /public
directory is the root directory of the generated website, just upload it.
This design is also inspired by
hexo
.
Development Plan
Since Candlest is preparing for the Chinese college entrance examination in 2024, the development progress is likely to be delayed.
TOML Front Matter
related:
-
TOML Front Matter
default handling - More
TOML Front Matter
- Generate default
TOML Front Matter
via command line arguments - Sort articles by
TOML Front Matter
, and index articles by tags
Plugins and Extensibility:
- Use
config.toml
to manage webpage related parameters - Build a plugin management system and use the plugin management system to add
gitalk
,highlight.js
, etc. - Build a theme management system and create default themes
Code related:
- Seriously write error handling instead of
unwarp()
. - Write a server implementation that can meet the needs of the blog, or find a library that is both lightweight and high-performance
- Organize projects and learn the project format of crates.io
Documentation related:
- Generate list of contributors using GitHub Action
- Disassemble README
TOML Front Matter
Currently, there are two TOML Front Matter
formats: Post and Page.
#[derive(Serialize, Deserialize, Debug)]
pub struct Post {
title: String,
datetime: Datetime,
tags: Vec<String>,
category: String,
}
#[derive(Serialize, Deserialize, Debug)]
pub struct Page {
title: String,
}
We can set the properties of the markdown
document through TOML Front Matter
and access them through the tera
templating language.
relevant
- ONEPAGE gave me great inspiration, especially the part of rendering templates.
- Hexo, as a static blog generator with both scalability and ease of use, cultivated my user habits and gave me inspiration for command line design.
- I refer to a lot of information on the Internet, and I will explain the main parts in my Development Record.
Contributors
Any contributions are welcome!
license
This project uses MIT License open source.