/theme-m/cover.webp

Introducing Theme-M

Illustration by LSD, pixiv artwork id 81079118

THEME-M 从 2019 年初创建文件夹,于 2020 年 7 月重写。 重写后卖相更好+精简依赖项,目前只有 MDUI 必须引用;以至于我的样式补丁直接打在页首。 新外观参考了不少主题/网站,这里就不一个个列出来了。 我个人属于简洁主义者尽管源码并不简洁,所以只实现了自己需要的功能。 jQuery 再见!

我真的不擅长写 EJS/JS,语法臃肿以后再改进吧或者不改进了

项目地址

kwaa/m

功能说明

NPM 安装

Hexo 5.0 之后增加了通过 NPM 安装主题的功能,我也想把主题发布到 NPM 上但这和滚动更新的特点不合,所以还是等一段时间吧。

自动暗模式

MDUI 自带(我提了个 issue),在主题里卡片和卡片以外是分开设置的(分别为 theme.mdui.layout 和 theme.m.layout,theme.m.layout 未设置时自动使用 theme.mdui.layout 的值)。

评论

只做了 Utterances。以后加上 Disqus,其他的目前不考虑。

PJAX

重写后用的是MoOx/pjax,不需要 jQuery。 没有进度条,因为我觉得淡入淡出效果足够了。

Lazyload

能够 loading=“lazy” 完事,又何必弄那么麻烦?

TOC

放弃了

语法高亮

更新:Hexo 5.0 原生支持 Prism.js。 所以你只需要在博客的 _config.yml 启用 prism,再在载入主题的 _config.yml 自定义 css 即可。

搜索

自动生成高端大气的 Google 搜索。本地搜索待重写

文档

不打算写文档。暂时

版本号

Theme-M 不设版本号,如果你是来自未来的其他使用者,你可以把 git pull 当作滚动更新; 需要注意,我随时可能根据自己的喜好调整/删除任何内容。

许可证

我讨厌 GPL 的传染性,所以不会用它。 MIT?Apache2.0?这些都很好,但我还是想用—— WTFPL(Do What The Fuck You Want To Public License). You just DO WHAT THE FUCK YOU WANT TO!

样式测试

以免麻烦,顺手放在这里。

当你凝视着 bug,bug 也凝视着你 不能信任那些 Terminal 或 Editor 用白底的人

text
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
rust
#[derive(Debug)]
pub enum State {
Start,
Transient,
Closed,
}
impl From<&'a str> for State {
fn from(s: &'a str) -> Self {
match s {
"start" => State::Start,
"closed" => State::Closed,
_ => unreachable!(),
}
}
}
json
[
{
"title": "apples",
"count": [12000, 20000],
"description": { "text": "...", "sensitive": false }
},
{
"title": "oranges",
"count": [17500, null],
"description": { "text": "...", "sensitive": false }
}
]
python
@requires_authorization
def somefunc(param1='', param2=0):
r'''A docstring'''
if param1 > param2: # interesting
print 'Gre'ater'
return (param2 - param1 + 1 + 0b10l) or None
class SomeClass:
pass
>>> message = '''interpreter
... prompt'''
html
<!DOCTYPE html>
<title>Title</title>
<style>
body {
width: 500px;
}
</style>
<script type="application/javascript">
function $init() {
return true
}
</script>
<body>
<p checked class="title" id="title">Title</p>
</body>
javascript
function $initHighlight(block, cls) {
try {
if (cls.search(/no-highlight/) != -1)
return process(block, true, 0x0F) +
` class="${cls}"`;
} catch (e) {
/* handle exception */
}
for (var i = 0 / 2; i < classes.length; i++) {
if (checkCondition(classes[i]) === undefined)
console.log('undefined');
}
return (
<div>
<web-component>{block}</web-component>
</div>
)
}
export $initHighlight;
cpp
#include <iostream>
int main(int argc, char *argv[]) {
/* An annoying "Hello World" example */
for (auto i = 0; i < 0xFFFF; i++)
cout << "Hello, World!" << endl;
char c = '\n';
unordered_map <string, vector<string> > m;
m["key"] = "\\"; // this is an error
return -2e3 + 12l;
}
sql
CREATE TABLE "topic" (
"id" serial NOT NULL PRIMARY KEY,
"forum_id" integer NOT NULL,
"subject" varchar(255) NOT NULL
);
ALTER TABLE "topic"
ADD CONSTRAINT forum_id FOREIGN KEY ("forum_id")
REFERENCES "forum" ("id");
-- Initials
insert into "topic" ("forum_id", "subject")
values (2, 'D''artagnian');
objective-c
#import <UIKit/UIKit.h>
#import "Dependency.h"
@protocol WorldDataSource
@optional
- (NSString*)worldName;
@required
- (BOOL)allowsToLive;
@end
@property (nonatomic, readonly) NSString *title;
- (IBAction) show;
@end
java
/**
* @author John Smith <john.smith@example.com>
*/
package l2f.gameserver.model;
public abstract class L2Char extends L2Object {
public static final Short ERROR = 0x0001;
public void moveTo(int x, int y, int z) {
_ai = null;
log("Should not be called");
if (1 > 5) { // wtf!?
return;
}
}
}
swift
import Foundation
@objc class Person: Entity {
var name: String!
var age: Int!
init(name: String, age: Int) {
/* /* ... */ */
}
// Return a descriptive string for this person
func description(offset: Int = 0) -> String {
return "(name) is (age + offset) years old"
}
}
css
@font-face {
font-family: Chunkfive;
src: url('Chunkfive.otf');
}
body,
.usertext {
color: #f0f0f0;
background: #600;
font-family: Chunkfive, sans;
}
@import url(print.css);
@media print {
a[href^='http']::after {
content: attr(href);
}
}
ruby
# The Greeter class
class Greeter
def initialize(name)
@name = name.capitalize
end
def salute
puts "Hello #{@name}!"
end
end
g = Greeter.new("world")
g.salute
makefile
# Makefile
BUILDDIR = _build
EXTRAS ?= $(BUILDDIR)/extras
.PHONY: main clean
main:
@echo "Building main facility..."
build_main $(BUILDDIR)
clean:
rm -rf $(BUILDDIR)/*
go
package main
import "fmt"
func main() {
ch := make(chan float64)
ch <- 1.0e10 // magic number
x, ok := <- ch
defer fmt.Println(`exitting now`)
go println(len("hello world!"))
return
}
bash
#!/bin/bash
###### CONFIG
ACCEPTED_HOSTS="/root/.hag_accepted.conf"
BE_VERBOSE=false
if [ "$UID" -ne 0 ]
then
echo "Superuser rights required"
exit 2
fi
genApacheConf(){
echo -e "# Host ${HOME_DIR}$1/$2 :"
}
ini
; boilerplate
[package]
name = "some_name"
authors = ["Author"]
description = "This is
a description"
[[lib]]
name = ${NAME}
default = True
auto = no
counter = 1_000

Heading 1

Heading 2

Heading 3

Heading 4

Heading 5
Heading 6

Paragraph

Lorem ipsum dolor sit amet, test link consectetur adipiscing elit. Strong text pellentesque ligula commodo viverra vehicula. Italic text at ullamcorper enim. Morbi a euismod nibh. Underline text non elit nisl. Deleted text tristique, sem id condimentum tempus, metus lectus venenatis mauris, sit amet semper lorem felis a eros. Fusce egestas nibh at sagittis auctor. Sed ultricies ac arcu quis molestie. Donec dapibus nunc in nibh egestas, vitae volutpat sem iaculis. Curabitur sem tellus, elementum nec quam id, fermentum laoreet mi. Ut mollis ullamcorper turpis, vitae facilisis velit ultricies sit amet. Etiam laoreet dui odio, id tempus justo tincidunt id. Phasellus scelerisque nunc sed nunc ultricies accumsan.

Interdum et malesuada fames ac ante ipsum primis in faucibus. Sed erat diam, blandit eget felis aliquam, rhoncus varius urna. Donec tellus sapien, sodales eget ante vitae, feugiat ullamcorper urna. Praesent auctor dui vitae dapibus eleifend. Proin viverra mollis neque, ut ullamcorper elit posuere eget.

Praesent diam elit, interdum ut pulvinar placerat, imperdiet at magna.

Maecenas ornare arcu at mi suscipit, non molestie tortor ultrices. Aenean convallis, diam et congue ultricies, erat magna tincidunt orci, pulvinar posuere mi sapien ac magna. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Praesent vitae placerat mauris. Nullam laoreet ante posuere tortor blandit auctor. Sed id ligula volutpat leo consequat placerat. Mauris fermentum dolor sed augue malesuada sollicitudin. Vivamus ultrices nunc felis, quis viverra orci eleifend ut. Donec et quam id urna cursus posuere. Donec elementum scelerisque laoreet.

List Types

Definition List (dl)

Definition List Title
This is a definition list division.

Ordered List (ol)

  1. List Item 1
  2. List Item 2
  3. List Item 3

Unordered List (ul)

  • List Item 1
  • List Item 2
  • List Item 3

Checkbox List (ul)

  • List Item 1 unchecked
  • List Item 2 checked
  • List Item 3 checked

Table

Table Header 1 Table Header 2 Table Header 3
Division 1 Division 2 Division 3
Division 1 Division 2 Division 3
Division 1 Division 2 Division 3

Misc Stuff - abbr, acronym, sub, sup, kbd, etc.

Lorem superscript dolor subscript amet, consectetuer adipiscing elit. Nullam dignissim convallis est. Quisque aliquam. cite. Nunc iaculis suscipit dui. Nam sit amet sem. Aliquam libero nisi, imperdiet at, tincidunt nec, gravida vehicula, nisl. Praesent mattis, massa quis luctus fermentum, turpis mi volutpat justo, eu volutpat enim diam eget metus. Maecenas ornare tortor. Donec sed tellus eget sapien fringilla nonummy. NBA Mauris a ante. Suspendisse quam sem, consequat at, commodo vitae, feugiat in, nunc. Morbi imperdiet augue quis tellus. AVE. Use Crtl + C to stop.