HMCL-docs/_plugins/front_matter_enhancer.rb
neveler 8898bb5997
All checks were successful
continuous-integration/drone/push Build is passing
添加一种新的 frontmatter 格式 (#466)
2026-06-07 17:31:45 +08:00

14 lines
342 B
Ruby

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