motor-cms/motor-docs

Motor 文档包

安装: 139

依赖: 0

建议者: 0

安全性: 0

星标: 0

关注者: 2

分支: 0

开放问题: 0

语言:SCSS

1.1.0 2021-04-17 18:00 UTC

This package is auto-updated.

Last update: 2024-09-18 01:58:40 UTC


README

一个简单的 Laravel 包,用于向您的项目添加多包文档。还支持搜索功能!

安装

您可以通过 composer 使用以下命令安装此包

composer require motor-cms/motor-docs

发布必要的资源(仅一个 CSS 和一个 JS 文件)

php artisan vendor:publish --tag=motor-docs

配置

接下来,在您的配置目录中创建一个名为 'motor-docs.php' 的文件

<?php

return [
    'route'     => 'documentation',
    'name'      => 'Motor-Docs',
    'logo'      => 'images/motor-logo-white-cropped.png',
    'copyright' => 'Reza Esmaili',
    'packages' => [
        'motor-docs' => [ // this should match with your package name. use 'local' for the main app
            'position'   => 1, // sets the sorting position for this package
            'name'       => 'Motor-Docs',
            'navigation' => '_navigation' // name of your sidebar navigation markdown file
        ]
    ]

];

为您的其他包重复此操作。仅包含 'packages' 数组是安全的。(您也可以将所有包放在主 motor-docs.php 文件中)

<?php
return [
    'packages' => [
        'second-package' => [ // this should match with your package name. use 'local' for the main app
            'position'   => 2, // sets the sorting position for this package
            'name'       => 'Second package',
            'navigation' => '_navigation' // name of your sidebar navigation markdown file
        ]
    ]
];

将以下代码添加到您的服务提供者的 boot() 方法中。为每个包都这样做。

$config = $this->app['config']->get('motor-docs', []);
$this->app['config']->set('motor-docs',
    array_replace_recursive(require __DIR__.'/../../config/motor-docs.php', $config));

编写文档

在您的资源/文档文件夹中添加 Markdown (.md) 文件。该包将自动渲染您在 _navigation.md 文件中定义的导航树。

祝您玩得开心!

阅读您的文档

默认情况下,您的文档在 https://[HOST]/documentation 可用。您可以在主 motor-docs.php 配置文件中更改路由。

待办事项

  • ajax 搜索
  • 更好的文档(哈哈)
  • 如何使用 Laravel mix 构建资源的说明

致谢

关于 Motor

...

许可协议

...