定制 aw-studio/docdress 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

aw-studio/docdress

Composer 安装命令:

composer require aw-studio/docdress

包简介

README 文档

README

A package to create markdown documentations from GitHub repositories in your Laravel project. Easy editing for contributors.

Docdress

The example image shows the litstack documenation. The GitHub repository can be found under litstack/litstack.io.

Table Of Contents

Introduction

With Docdress you can turn your project/package documentation within minutes into a web interface with a Laravel-like design.

Docdress offers the following features:

  • Laravel-like design
  • Documentation for private repositories
  • Documentation from subfolders of repositories
  • Automatically updated by webhooks
  • Any number of repositories in a Laravel project
  • Custom themes
  • Authentication

Setup

Install Docdress via composer:

composer require aw-studio/docdress

Now publish the required assets and the config:

php artisan vendor:publish --provider="Docdress\DocdressServiceProvider"

You may also publish the config or assetsonly like this:

php artisan vendor:publish --tag="docdress:assets"
php artisan vendor:publish --tag="docdress:config"

Add repository to Config

Add the desired repository to the docdress config.

'repos' => [
    'my/repo' => [
        //
    ],
],

Clone repository

Once you have configured the repository, you must clone it using docdress:clone:

php artisan docdress:clone "my/repo"

Structure

Readme.md

The index is built as a nested list in the readme.md. It is located under ## Index. So your readme.md could look like this:

# My Package

Hello World.

## Index

-   ## Getting Started
    -   [Introduction](introduction.md)
    -   [Installation](installation.md)
-   ## Foo
    -   [Bar](subfolder/bar.md)

Table of Contents

The table of contents is built from all ## and ### headings under the # heading. No link tag with a nameattribute is needed. You can easily build your markdown file as follows:

# Title

## Introduction

...

Configuration

With Docdress any number of repositories can be documented in one laravel project. Each repository is configured in docdress.repos like so:

'repos' => [
    'my/repo' => [
        // ...
    ],
],

The following attributes can be configured for a repository:

  • route_prefix - The route prefix under which the documentation is accessible.
  • default_page - The default page
  • versions - An array containing the branches that should be available in the documentation.
  • default_version - The current version.
  • subfolder - The subfolder of the documentation.
  • theme - The theme that should be used for this repo. Default value: default.
  • access_token - Personal access token for private repositories.
  • webhook_token - Webhook token to allow pulling the repository after a change.

Some of the attributes are discussed in more detail below:

Versions

Every version is representing a branch. Set the default_version to your default branch. The versions are specified as branch name and title, like so:

'repos' => [

    'my/repo' => [
        // ...
        'default_version' => 'master',
        'versions'        => [
            'master' => 'Master',
            '1.0'    => '1.0'
        ]'
    ],

],

Private repositories

Private repositories require a personal access token with the read permissions for the repository.

'repos' => [

    'my/repo' => [
        // ...
        'access_token' => env('GITHUB_ACCESS_TOKEN', null)
    ],

],

Subfolder

You may have the documentation of a project or a package in a subfolder of the corresponding repository. If a subfolder is specified in the config, only this folder is cloned and displayed.

'repos' => [

    'my/repo' => [
        // ...
        'subfolder' => 'docs'
    ],

],

Webhook

If you want the latest version to be automatically updated with every push, you have to set a webhook with the url _docdress/update.

webhook-url

Additionally the Content-Type must be set to application/json.

webhook-content-type

And the token from your config must be specified.

'repos' => [

    'my/repo' => [
        // ...

        'webhook_token' => env('GITHUB_WEBHOOK_TOKEN', null),
    ],

],

Algolia

Docdress Search

Algolia Docsearch can be used for the search of your documenation. All you have to do is to specify your application key for the respective repository.

'repos' => [

    'my/repo' => [
        // ...

        'algolia_app_key' => env('ALGOLIA_APP_KEY', null),
    ],

],

Authorization

You may create gate for a repository in the boot method of your AuthServiceProvider to manage access to the documentation.

use Docdress\Docdress;

public function boot()
{
    $this->registerPolicies();

    Docdress::gate('my/repo', function ($user) {
        return $user->is_admin;
    });
}

Alerts

You may display alerts just like custom-blocks in vuepress. The available alert types are tip, warning, danger

::: tip

Hello World!

:::
::: warning

Hello World!

:::
::: danger

Hello World!

:::

alert-tip alert-warning alert-danger

Search Component

By using the x-dd-search-input component. You can place the algolia search input in your blade views. The component needs the repo that should be searched and the desired version.

<x-dd-search-input repo="my/repo" version="1.0" />

Testing

Execute tests via composer:

composer test

aw-studio/docdress 适用场景与选型建议

aw-studio/docdress 是一款 基于 Blade 开发的 Composer 扩展包,目前已累计 1.59k 次下载、GitHub Stars 达 64, 最近一次更新时间为 2020 年 08 月 19 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 aw-studio/docdress 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 aw-studio/docdress 我们能提供哪些服务?
定制开发 / 二次开发

基于 aw-studio/docdress 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 1.59k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 64
  • 点击次数: 4
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 64
  • Watchers: 5
  • Forks: 2
  • 开发语言: Blade

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-08-19