添加一种新的 frontmatter 格式 (#466)
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
neveler 2026-06-07 17:31:45 +08:00 committed by GitHub
parent aa9f72ebfe
commit 8898bb5997
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
17 changed files with 45 additions and 30 deletions

View File

@ -0,0 +1,13 @@
module Jekyll
class Document
YAML_FRONT_MATTER_REGEXP = %r!\A(?:---|/\* @frontmatter)\s*\n(.*?\n?)^((?:---|\*/|\.\.\.)\s*$\n?)!m.freeze
end
module Utils
def has_yaml_header?(file)
File.open(file, "rb", &:readline).match? %r!\A(---|/\* @frontmatter)\s*\r?\n!
rescue EOFError
false
end
end
end

View File

@ -1,5 +1,5 @@
--- /* @frontmatter
--- */
@charset "utf-8"; @charset "utf-8";

View File

@ -1,5 +1,5 @@
--- /* @frontmatter
--- */
@charset "utf-8"; @charset "utf-8";

View File

@ -1,5 +1,5 @@
--- /* @frontmatter
--- */
@charset "utf-8"; @charset "utf-8";

View File

@ -1,5 +1,5 @@
--- /* @frontmatter
--- */
@charset "utf-8"; @charset "utf-8";

View File

@ -1,5 +1,5 @@
--- /* @frontmatter
--- */
@charset "utf-8"; @charset "utf-8";

View File

@ -1,5 +1,5 @@
--- /* @frontmatter
--- */
@charset "utf-8"; @charset "utf-8";

View File

@ -1,5 +1,5 @@
--- /* @frontmatter
--- */
@charset "utf-8"; @charset "utf-8";

View File

@ -1,2 +1,2 @@
--- /* @frontmatter
--- */

View File

@ -1,5 +1,5 @@
--- /* @frontmatter
--- */
@charset "utf-8"; @charset "utf-8";

View File

@ -1,5 +1,5 @@
--- /* @frontmatter
--- */
@charset "utf-8"; @charset "utf-8";

View File

@ -1,5 +1,5 @@
--- /* @frontmatter
--- */
@charset "utf-8"; @charset "utf-8";

View File

@ -1,5 +1,5 @@
--- /* @frontmatter
--- */
@charset "utf-8"; @charset "utf-8";

View File

@ -1,5 +1,5 @@
--- /* @frontmatter
--- */
@charset "utf-8"; @charset "utf-8";

View File

@ -1,6 +1,7 @@
--- /* @frontmatter
layout: null layout: null
--- */
(function () { (function () {
const PREFIX = "HMCL_DOCS_SETTINGS_", data = {}, bus = new EventTarget(), configs = /*{%comment%}*/{}/*{%endcomment%}*/ /**{{'/'}}{{ site.data.settings | jsonify }}/**/; const PREFIX = "HMCL_DOCS_SETTINGS_", data = {}, bus = new EventTarget(), configs = /*{%comment%}*/{}/*{%endcomment%}*/ /**{{'/'}}{{ site.data.settings | jsonify }}/**/;
window.addEventListener("storage", ({ key, newValue }) => key !== null && key.startsWith(PREFIX) && newValue !== data[key] && bus.dispatchEvent(new CustomEvent(key, { detail: (data[key] = newValue) }))); window.addEventListener("storage", ({ key, newValue }) => key !== null && key.startsWith(PREFIX) && newValue !== data[key] && bus.dispatchEvent(new CustomEvent(key, { detail: (data[key] = newValue) })));

View File

@ -1,6 +1,7 @@
--- /* @frontmatter
layout: null layout: null
--- */
window.addEventListener("DOMContentLoaded", function () { window.addEventListener("DOMContentLoaded", function () {
var skinLink = document.getElementById("skin"); var skinLink = document.getElementById("skin");
var darkModeQuery = window.matchMedia("(prefers-color-scheme: dark)"); var darkModeQuery = window.matchMedia("(prefers-color-scheme: dark)");