编程解剖 in rust

以rust为例分享学习编程常考虑的方方面面

本地运行

cargo install mdbook
mdbook serve

git lfs配置

git lfs install 
git lfs track '*.img'

项目基础结构

{{#check | }}

  1. 每个文件夹下的同名md文件介绍当前文件夹的内容
  2. 关于待完成内容:主要基于mdbook-checklist插件
    - [待完成](checklist.md) 
  1. 添加待完成锚点的格式

check空格之后的内容不能有空格, 且只能为英文 “ | “之后的内容可以有空格,可以为中文

<a id="Note-1"></a>Note-1
  • checklist页面渲染效果:
- <SUMMARY对应标题名>
    - [This is an important note](Note-1)

这种写法会自动在本地生成md文件:src/checklist.md, 但是不用管它,最后渲染还是以mdbook-checklist的内容为准

用到的工具

来自:Mdbook - Apple Power User

mdbook-checklist: 整理待办事项

ANSSI-FR/mdbook-checklist: mdbook preprocessor for generating checklists and indexes

cargo install mdbook-checklist

mdbook-checklist - crates.io: Rust Package Registry

mdbook-pagetoc: 添加业内目录

JorelAli/mdBook-pagetoc: A page table of contents for mdBook

mdbook-admonish: 使用新的css文件

相关资源

All supported directives are listed below.

特别语法

自定义标题

数据损失

The following steps can lead to irrecoverable data corruption.

内嵌代码

内嵌代码

This syntax won’t work in Python 3:

print "Hello, world!"
自定义样式

Note

Styled with my custom CSS class.

可折叠

Note

Content will be hidden initially.

常用格式

note

Note

Rust is a multi-paradigm, general-purpose programming language designed for performance and safety, especially safe concurrency.

abstract, summary, tldr

Abstract

Rust is a multi-paradigm, general-purpose programming language designed for performance and safety, especially safe concurrency.

info, todo

Info

Rust is a multi-paradigm, general-purpose programming language designed for performance and safety, especially safe concurrency.

tip, hint, important

Tip

Rust is a multi-paradigm, general-purpose programming language designed for performance and safety, especially safe concurrency.

success, check, done

Success

Rust is a multi-paradigm, general-purpose programming language designed for performance and safety, especially safe concurrency.

question, help, faq

Question

Rust is a multi-paradigm, general-purpose programming language designed for performance and safety, especially safe concurrency.

warning, caution, attention

Warning

Rust is a multi-paradigm, general-purpose programming language designed for performance and safety, especially safe concurrency.

failure, fail, missing

Failure

Rust is a multi-paradigm, general-purpose programming language designed for performance and safety, especially safe concurrency.

danger, error

Danger

Rust is a multi-paradigm, general-purpose programming language designed for performance and safety, especially safe concurrency.

bug

Bug

Rust is a multi-paradigm, general-purpose programming language designed for performance and safety, especially safe concurrency.

example

Example

Rust is a multi-paradigm, general-purpose programming language designed for performance and safety, especially safe concurrency.

quote, cite

Quote

Rust is a multi-paradigm, general-purpose programming language designed for performance and safety, especially safe concurrency.

github action

基于github repository设置secrects token

Access Token | Code Cookbook

  1. 设置token:Personal access tokens
  2. 给指定repository设置secret:repository -> settings -> secrets -> Actions
  3. 新建一个名为GH_MD_TOC的repository secret,将第一步的token设置进去
  4. 将这个secret设置为action环境变量