cable8mm / db-to-markdown
数据库到markdown生成器
v1.3.3
2024-03-09 15:44 UTC
Requires
- php: ^8.0.2
- cable8mm/array-flatten: ^1.0
- catfan/medoo: ^2.0
- league/html-to-markdown: ^5.0
- nesbot/carbon: ^2.72.0|^3.0
- symfony/console: ^6.0|^7.0
- vlucas/phpdotenv: ^5.0
Requires (Dev)
- fakerphp/faker: ^1.23
- laravel/pint: ^1.0
- phpunit/phpunit: ^9.0|^10.0|^11.0
README
此工具专门用于生成Markdown文件,尤其适用于从数据库创建Jekyll Markdown文档。您可以生成自己的Markdown,例如Jekyll、Astro、Gatsby或您喜欢的任何其他格式。
我们在网站上提供了API文档。更多信息,请访问 https://www.palgle.com/db-to-markdown/ ❤️
特性
- 任何模式都可以生成所需格式的Markdown
- 轻松集成自定义映射器和命令
- 实现回调体和日期时间功能
- 支持数据库测试
预览
支持 & 测试
安装
composer create-project cable8mm/db-to-markdown
使用方法
配置 .env
以连接到您自己的数据库。如果未提供 .env
配置,则建立SQLite连接。
bin/console seeding
# If `.env` configuration is not provided, seeding must be performed.
已建立数据库连接,
bin/console create-md # Convert the database to markdown files in the dist folder. bin/console create-jekyll # Convert the database to markdown files suitable for Jekyll in the dist folder. bin/console clean # Clear the contents of the dist folder.
如何开发自定义命令
- 请在
.env
文件中填写数据库连接信息。您可以通过使用composer测试命令来验证它。 - 您可以在
src/Mappers/
文件夹中创建映射类,用于输入,并在src/Formats
中创建格式类,用于输出。 - 最后,您可以在
src/Command
文件夹中创建您选择的命令。
我已经准备了映射器、格式类和命令。
格式化
composer lint # Modify all files to comply with the PSR-12. composer inspect # Inspect all files to ensure compliance with PSR-12.
测试
它使用内置的SQLite数据库,而不是您自己的数据库。它永远不会损害您的数据。您不必担心这一点。
composer test
许可证
DB to markdown项目是开源软件,许可协议为MIT许可证。