diff --git a/.editorconfig b/.editorconfig index b02db26..00b727e 100644 --- a/.editorconfig +++ b/.editorconfig @@ -11,3 +11,6 @@ max_line_length = 120 [*.php] indent_size = 4 + +[composer.*] +indent_size = 4 diff --git a/CHANGELOG.md b/CHANGELOG.md index 9edde7f..9567cbf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ CHANGELOG ========= -2.0.0 (2023-12-22) +2.0.0 (2024-02-02) ------------------ * Enable Symfony 7 diff --git a/README.md b/README.md index cea3515..7bcc4a9 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,53 @@ This library can be installed via Composer: Usage ----- +This library can parse all form of front matter: + + + + + + + + +
YAML (Neon)TOMLJson
+ +```markdown +--- +foo: bar +--- + +# h1 + +paragraph +``` + + + +```markdown ++++ +foo = bar ++++ + +# h1 + +paragraph +``` + + + +```markdown +{ + "foo": "bar" +} + +# h1 + +paragraph +``` + +
+ ### Parse an arbitrary string ```php @@ -95,8 +142,8 @@ Hello world! Available converters: | Converter | Twig | -| ----------------------------------------- | ---------------------------------------------------------- | -| `DataToTwigConvertor::nothing()` | `` | +| ----------------------------------------- |------------------------------------------------------------| +| `DataToTwigConvertor::nothing()` | | | `DataToTwigConvertor::vars()` | `{% set key1 = value1 %}` | | `DataToTwigConvertor::vars(false)` | `{% set key1 = key1 is defined ? key1 : value1 %}` | | `DataToTwigConvertor::var('name')` | `{% set name = {key1: value1, key2: value2} %}` | @@ -133,5 +180,6 @@ Alternatives ------------ - https://github.com/spatie/yaml-front-matter +- https://github.com/ergebnis/front-matter - https://github.com/mnapoli/FrontYAML - https://github.com/Modularr/YAML-FrontMatter