Accept pandoc-style YAML frontmatter
Pandoc (and some other tools) have decided to end their YAML frontmatter with `...` instead of `---`. In the name of flexibility, this patch allows either to mark the end of YAML frontmatter. Example: ``` --- title: No place like home ... ```
This commit is contained in:
parent
fae0e00f42
commit
6895f30ff3
3 changed files with 25 additions and 1 deletions
|
@ -119,7 +119,7 @@ module Middleman::CoreExtensions
|
|||
# @param [String] content
|
||||
# @return [Array<Hash, String>]
|
||||
def parse_yaml_front_matter(content, full_path)
|
||||
yaml_regex = /\A(---\s*\n.*?\n?)^(---\s*$\n?)/m
|
||||
yaml_regex = /\A(---\s*\n.*?\n?)^((---|\.\.\.)\s*$\n?)/m
|
||||
if content =~ yaml_regex
|
||||
content = content.sub(yaml_regex, '')
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue