dontdrinkandroot/gitki-bundle

Symfony Bundle,让您轻松将基于 git 的维基集成到项目中

安装: 536

依赖者: 1

建议者: 0

安全: 0

星星: 9

关注者: 7

分支: 2

开放问题: 18

类型:symfony-bundle

v0.2.0 2018-02-28 13:58 UTC

README

Latest Stable Version License Continuous Integration Coverage Maintainability Rating Reliability Rating Security Rating

关于

Symfony Bundle,让您轻松将基于 git 的维基集成到项目中。

此项目目前处于 alpha 状态。它正在运行,但变化频繁。

功能

  • 基于 Git
  • 完全集成的 Markdown 支持(commonmark)
  • 可选的 Elasticsearch 集成
  • 最小配置
  • 易于扩展
  • 易于集成

安装

使用 composer 安装

composer require dontdrinkandroot/gitki-bundle

在您的项目的 app/AppKernel.php 文件中添加以下行以启用此包

// app/AppKernel.php
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...
            new Dontdrinkandroot\GitkiBundle\DdrGitkiBundle(),
        );

        // ...
    }
}

要在此项目中使用此包,传递给包的 User 类必须实现 Dontdrinkandroot\GitkiBundle\Model\GitUserInterface。幸运的是,这与 FOSUserBundle 兼容。

配置

app/config/config.yml 中配置此包。至少需要仓库路径,该路径必须指向一个由 web 服务器初始化且可读/可写的 git 仓库。

# Default configuration for extension with alias: "ddr_gitki"
ddr_gitki:

    # The path to the git repository containing the wiki files. Must end with slash.
    repository_path:      ~ # Required

    # When enabled breadcrumbs are shown for easy navigation
    show_breadcrumbs:     true

    # When enabled the files and folders of the containing directory are shown while viewing a file
    show_directory_contents: true

    # Markdown specific configuration
    markdown:

        # When disabled all html content is escaped
        allow_html:           false
        toc:

            # Show the table of contents
            enabled:              true

            # Max depth of the table of contents
            max_level:            3

    # Configure elasticsearch integration
    elasticsearch:
        index_name:           ~ # Required
        host:                 localhost
        port:                 9200

    # Maps user roles to internal roles
    roles:

        # Is allowed to view content
        watcher:              IS_AUTHENTICATED_ANONYMOUSLY

        # Is allowed to edit content
        committer:            ROLE_USER
        admin:                ROLE_ADMIN

    # The file names that are used as a directory index. Searched in the order defined.
    index_files:

        # Defaults:
        - index.md
        - README.md
        - index.txt
        - README.txt

将路由添加到 app/config/routing.yml

ddr_gitki_base:
resource: "@DdrGitkiBundle/Resources/config/routing.yml"
prefix: /wiki

开发

在本地 Docker 中运行 Elasticsearch

docker run -p 127.0.0.1:9200:9200 -p 127.0.0.1:9300:9300 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:7.16.3

源代码