soltys/slate-bundle

此包已被放弃且不再维护。未建议替代包。

此包为您的 REST API 提供可配置的 Slate 文档。

安装次数: 2,347

依赖者: 0

建议者: 0

安全: 0

星标: 4

关注者: 1

分支: 2

开放问题: 0

语言:HTML

类型:symfony-bundle

1.0.2 2017-12-12 16:42 UTC

This package is auto-updated.

Last update: 2022-02-01 13:11:15 UTC


README

此包为您的 REST API 提供可配置的 Slate 文档。

步骤 1:下载包

通过 Composer 将 SoltysSlateBundle 添加到您的项目中

$ composer require soltys/slate-bundle "~1"

步骤 2:启用包

然后,通过将其添加到项目中的 app/AppKernel.php 文件中注册的包列表中来启用该包

<?php
// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...
            new Soltys\Bundle\SoltysSlateBundle\SoltysSlateBundle(),
        );

        // ...
    }

    // ...
}

步骤 3:配置包

在您的 routing.yml 文件中添加以下行

# app/config/routing.yml
SoltysSlateBundle:
    resource: "@SoltysSlateBundle/Resources/config/routing.yml"
    prefix:   /api/documentation

然后通过在您的 config.yml 中添加以下内容来配置包

# app/config/config.yml
soltys_slate:
    language_tabs: ["shell", "ruby", "python", "javascript"]
    includes: ["SoltysSlateBundle:Slate/Includes:_errors.md.twig"]
    toc_footers: ["SoltysSlateBundle:Slate/Footers:_footer.html.twig"]

完整的包配置参考如下

# app/config/config.yml
soltys_slate:
    title: "API Documentation"                            # Your documentation title
    navbar_path: "bundles/soltysslate/images/navbar.png"  # Your navbar image path
    logo_path: "bundles/soltysslate/images/logo.png"      # Your logo path
    with_search: true                                     # Enable/Disable the search bar
    page_classes: "index"                                 # Add this CSS class to the HTML <body> tag
    language_tabs: ["shell", "ruby", "python", "javascript"] # List the languages in which you want to write your examples
    includes: ["SoltysSlateBundle:Slate/Includes:_errors.md.twig"] # Additional templates
    toc_footers: ["SoltysSlateBundle:Slate/Footers:_footer.html.twig"] # Footer template

您现在可以使用以下命令安装您的资源

$ bin/console assets:install web --symlink

然后清除您的缓存

$ bin/console cache:clear

步骤 4:使用

要编写自己的文档(除非您喜欢小猫),在 app/Resources/SoltysSlateBundle/views/Slate/MarkDown 目录下创建一个 index.md.twig 文件以覆盖默认文件。