فهرست منبع

Add ability to customise intro text

shalvah 5 سال پیش
والد
کامیت
6a0bdbab84
3فایلهای تغییر یافته به همراه15 افزوده شده و 4 حذف شده
  1. 10 0
      config/scribe.php
  2. 1 3
      resources/views/index.blade.php
  3. 4 1
      src/Writing/Writer.php

+ 10 - 0
config/scribe.php

@@ -58,10 +58,20 @@ return [
 
         /*
          * Any extra info for your users. For instance, you can describe where to find (or generate) their auth credentials.
+         * Markdown and HTML are supported.
          */
         'extra_info' => 'You can retrieve your token by visiting your dashboard and clicking <b>Generate API token</b>.',
     ],
 
+    /*
+     * Text to place in the "Introduction" section. Markdown and HTML are supported.
+     */
+    'intro_text' => <<<INTRO
+Welcome to our API documentation!
+
+<aside>As you scroll, you'll see code examples for working with the API in different programming languages in the dark area to the right (or as part of the content on mobile), and you can switch the programming language of the examples with the tabs in the top right (or from the nav menu at the top left on mobile).</aside>
+INTRO,
+
     /*
      * Example requests for each endpoint will be shown in each of these languages.
      * Supported options are: bash, javascript, php, python

+ 1 - 3
resources/views/index.blade.php

@@ -4,6 +4,4 @@
 
 # Introduction
 
-Welcome to our API documentation!
-
-As you scroll, you'll see code examples for working with the API in different programming languages in the dark area to the right (or as part of the content on mobile), and you can switch the programming language of the examples with the tabs in the top right (or from the nav menu at the top left on mobile).
+{!! $text !!}

+ 4 - 1
src/Writing/Writer.php

@@ -228,8 +228,11 @@ class Writer
             ->with('outputPath', 'docs')
             ->with('settings', $settings);
         $indexFile = $this->sourceOutputPath . '/source/index.md';
+
+        $introText = $this->config->get('intro_text', '');
         $introMarkdown = view('scribe::index')
-            ->with('frontmatter', $frontmatter);
+            ->with('frontmatter', $frontmatter)
+            ->with('text', $introText);
         $this->writeFile($indexFile, $introMarkdown);
     }