rafie / gdoc
dev-master
2015-03-14 14:01 UTC
Requires
- php: >=5.3.3
- illuminate/container: 5.0.*
- illuminate/filesystem: 5.0.*
- illuminate/support: 5.0.*
- michelf/php-markdown: ~1.3
- symfony/console: ~2.1
- symfony/finder: ~2.1
- symfony/process: ~2.1
- symfony/yaml: ~2.1
- twig/twig: ~1.13
This package is auto-updated.
Last update: 2024-08-29 03:53:33 UTC
README
##文档生成器 API 文档很重要,但您应用程序项目的官方文档也同样重要。我尝试将 Sami 文档生成器 适配以帮助生成官方文档。
##安装 您可以在 composer.json
中要求 rafie/gdoc 并执行 composer update
。
##使用 您可以从命令行运行文档生成器。
$ php path/to/rafie.php generate your_config.php
如果配置文件必须返回 RAFIE\Configuration
实例,您可以使用包根目录内的配置文件,以下是一个示例。
use RAFIE\Configuration; use Symfony\Component\Finder\Finder; $dir = __DIR__ . '/doc'; $finder = Finder::create()->files()->in($dir); $docConf = $dir.'/doc.yml'; $options = [ 'theme' => 'laravel', 'build_path' => __DIR__ . '/build', 'themesPaths' => [__DIR__ . '/src/themes/'] ]; return new Configuration($finder, $docConf, $options);
您可以使用 Finder 来查找您的 Markdown 文档。使用 $docConf
可以描述您的文档导航结构,并且它将被解析并传递到您的主题文件中,例如,如果您想创建 Laravel 文档 结构。
navigation: Prologue: Releases Notes: releases.html Upgrade Guide: upgrade.html Contribution Guide: contributions.html Setup: Installation: installation.html Configuration: configuration.html ...
选项参数指定了三个属性,您的主题名称、主题路径(您存储主题的位置)以及输出结果的构建路径。
##使用 Git 您可以通过指定第四个选项来使用版本化文档。
$dir = __DIR__ . '/doc'; $finder = Finder::create()->files()->in($dir); $versions = RAFIE\Version\GitVersionCollection::create($dir) ->add('master', 'Master') ->add('4.2', '4.2'); $options = [ 'theme' => 'laravel', 'build_path' => __DIR__ . '/build/%version%', 'versions' => $versions, 'themesPaths' => [__DIR__ . '/src/themes/'] ]; $docConf = $dir . '/doc.yml'; return new Configuration($finder, $docConf, $options);
GitVersionCollection
允许您指定要用于生成的版本,并将结果作为选项传递。请注意,构建路径包含一个 %version%
,它表示用于输出的子目录结构。
##创建主题 您可以通过这个 Github 仓库 了解更多关于主题的信息。
##演示 gDocDemo 仓库包含一个生成 Laravel 框架文档的示例,我使用了他们的 CSS 文件和一些 HTML。