bulldog / front-matter
YAML/Markdown
v0.2.0
2018-09-11 13:28 UTC
Requires
- erusev/parsedown: ^1.7
- symfony/yaml: ^4.1
Requires (Dev)
- php-coveralls/php-coveralls: ^2.1
- phpunit/phpunit: ^7.3
This package is auto-updated.
Last update: 2024-09-05 18:26:06 UTC
README
本工具使用了 Parsedown 和 Symfony/Yaml.
示例
这是一个示例源文件。它顶部是YAML,下面是Markdown。
--- title: Hello World --- # Hello World It is i, levi. [test](https://google.com)
然后我们使用以下PHP代码读取配置和HTML。
<?php include 'vendor/autoload.php'; $fm = Bulldog\FrontMatter::load('file.yaml'); var_dump($fm->config()); // Output /* array(1) { 'title' => string(11) "Hello World" } */ var_dump($fm->html()); // Output /* string(85) "<h1>Hello World</h1><p>It is i, levi.</p><p><a href="https://google.com">test</a></p>" */