diff --git a/foliant/preprocessors/escapecode.py b/foliant/preprocessors/escapecode.py index e5e6875..088882b 100644 --- a/foliant/preprocessors/escapecode.py +++ b/foliant/preprocessors/escapecode.py @@ -39,7 +39,7 @@ def __init__(self, *args, **kwargs): self.content = None self.pre_blocks_pattern = None self._cache_dir_path = (self.project_path / self.options['cache_dir']).resolve() - self.frontmatter_pattern = re.compile(r'^((-|\+){3})\n([\s\S]*)\n((-|\+){3})([\s\S]*)') + self.frontmatter_pattern = re.compile(r'^((-|\+){3})\n([\s\S]+?)\n((-|\+){3})([\s\S]*)') self.logger = self.logger.getChild('escapecode') diff --git a/tests/data/expected/frontmatter_yaml.md b/tests/data/expected/frontmatter_yaml.md index 4cf3169..29586ce 100644 --- a/tests/data/expected/frontmatter_yaml.md +++ b/tests/data/expected/frontmatter_yaml.md @@ -4,6 +4,12 @@ # Test + + +--- + + + Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo diff --git a/tests/data/input/frontmatter_yaml.md b/tests/data/input/frontmatter_yaml.md index 1120396..e1d4385 100644 --- a/tests/data/input/frontmatter_yaml.md +++ b/tests/data/input/frontmatter_yaml.md @@ -6,6 +6,16 @@ tempor incididunt ut labore." # Test +```py +import re +``` + +--- + +```py +import os +``` + Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo