Skip to content

Commit 8898bb5

Browse files
authored
添加一种新的 frontmatter 格式 (#466)
1 parent aa9f72e commit 8898bb5

17 files changed

Lines changed: 45 additions & 30 deletions

_plugins/front_matter_enhancer.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
module Jekyll
2+
class Document
3+
YAML_FRONT_MATTER_REGEXP = %r!\A(?:---|/\* @frontmatter)\s*\n(.*?\n?)^((?:---|\*/|\.\.\.)\s*$\n?)!m.freeze
4+
end
5+
6+
module Utils
7+
def has_yaml_header?(file)
8+
File.open(file, "rb", &:readline).match? %r!\A(---|/\* @frontmatter)\s*\r?\n!
9+
rescue EOFError
10+
false
11+
end
12+
end
13+
end

assets/css/main.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
---
2-
---
1+
/* @frontmatter
2+
*/
33

44
@charset "utf-8";
55

assets/css/skins/air.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
---
2-
---
1+
/* @frontmatter
2+
*/
33

44
@charset "utf-8";
55

assets/css/skins/aqua.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
---
2-
---
1+
/* @frontmatter
2+
*/
33

44
@charset "utf-8";
55

assets/css/skins/catppuccin_latte.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
---
2-
---
1+
/* @frontmatter
2+
*/
33

44
@charset "utf-8";
55

assets/css/skins/catppuccin_mocha.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
---
2-
---
1+
/* @frontmatter
2+
*/
33

44
@charset "utf-8";
55

assets/css/skins/contrast.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
---
2-
---
1+
/* @frontmatter
2+
*/
33

44
@charset "utf-8";
55

assets/css/skins/dark.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
---
2-
---
1+
/* @frontmatter
2+
*/
33

44
@charset "utf-8";
55

assets/css/skins/default.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
---
2-
---
1+
/* @frontmatter
2+
*/

0 commit comments

Comments
 (0)