jekyll-hk-api-doc 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: c962343dcce7382a284b926b9bbd71e1169028c8917a003dc0bf7f2b212113f9
4
+ data.tar.gz: b6a9c7fb7da88d06ec6d324c2aabdfbe587dd44ed4fc0f5b20bc30ad67c8698e
5
+ SHA512:
6
+ metadata.gz: af5becd75297fa983dcf41d79f2b9a808c9ba65209abd520521b9308e94c2bfa01df089702c5e620acadbf1f58a81ae7ae8e25abc60410bd7daa4f433f6a0919
7
+ data.tar.gz: 1fa29febaf8ca8e07f2ea83f6b9aba2058f1bdc8527258d0913926db1066b972ee2bc02dc575167b9b7727d1bf39d8b8583fbac8b58c33ea7e0933af60735240
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2021
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,192 @@
1
+ # jekyll-hk-api-doc
2
+
3
+ A Simple API Doc with YAML powered by Jekyll
4
+
5
+ ## Installation
6
+
7
+ 1. Add the line below to your Jekyll site's `Gemfile`:
8
+
9
+ ```ruby
10
+ gem "jekyll-hk-api-doc"
11
+ ```
12
+
13
+ 2. Add the line below to your Jekyll site's `_config.yml`:
14
+
15
+ ```yaml
16
+ theme: jekyll-hk-api-doc
17
+ ```
18
+
19
+ 3. Create data directory `_api` and update `_config.yml`:
20
+
21
+ ```yaml
22
+ data_dir: _api
23
+ ```
24
+
25
+ 4. Write yaml in the data directory. Example:
26
+
27
+ ```yaml
28
+ name: Auth
29
+ description: APIs for authentication
30
+ base_url: /api/auth
31
+ apis:
32
+ - name: Sign In
33
+ url: /signin
34
+ method: post
35
+ description: |
36
+ Issue <code>access token</code> and <code>refresh token</code>
37
+ * Currently, the api is using <code>http</code> and it does have vulnerability of sending plain password, but it will soon be updated to <code>https</code>.
38
+ * <code>access token</code>s will be expired 10 minutes after they are issued.
39
+ * <code>refresh token</code>s will be expired 2 weeks after they are issued.
40
+ params:
41
+ body:
42
+ - name: id
43
+ is_required: true
44
+ type: string
45
+ description: ID
46
+ - name: pw
47
+ is_required: true
48
+ type: string
49
+ description: (plain) password
50
+ response:
51
+ success:
52
+ - status_code: 200
53
+ example: auth-signin-200
54
+ fail:
55
+ - status_code: 400
56
+ description: |
57
+ - Either one of <code>id</code> or <code>pw</code> is not included in the request.
58
+ - <code>id</code> is not registered.
59
+ - <code>id</code> and <code>pw</code> are not matching.
60
+ - name: ID Duplication Check
61
+ url: /id-duplicate-check
62
+ method: get
63
+ description: Checks if new <code>id</code> is duplicated or not
64
+ params:
65
+ query:
66
+ - name: id
67
+ is_required: true,
68
+ type: string
69
+ description: ID
70
+ response:
71
+ success:
72
+ - status_code: 200
73
+ description: <code>id</code> is not duplicated(good to use)
74
+ fail:
75
+ - status_code: 400
76
+ description: <code>id</code> is duplicated(not good to use)
77
+ - name: Sign Up
78
+ url: /signup
79
+ method: post
80
+ description: Create a new account.
81
+ params:
82
+ body:
83
+ - name: id
84
+ is_required: true
85
+ type: string
86
+ description: ID
87
+ - name: pw
88
+ is_required: true
89
+ type: string
90
+ description: (plain) Password
91
+ - name: nickname
92
+ is_required: true
93
+ type: string
94
+ description: Nickname
95
+ - name: email
96
+ is_required: true
97
+ type: string
98
+ description: Email
99
+ - name: age
100
+ is_required: true
101
+ type: int
102
+ description: Age
103
+ response:
104
+ success:
105
+ - status_code: 200
106
+ description: New account has been successfully created.
107
+ fail:
108
+ - status_code: 400
109
+ description: |
110
+ - Either one of <code>id</code>, <code>pw</code>, <code>nickname</code>, <code>email</code> or <code>age</code> is not included in the request or not a proper type.
111
+ - <code>id</code> already registered(duplicated id)
112
+ - name: Refresh Token
113
+ url: /refresh
114
+ method: get
115
+ description: |
116
+ Re-issue an access token with <code>refresh token</code>
117
+ params:
118
+ header:
119
+ - name: x-access-token
120
+ is_required: true
121
+ type: string
122
+ description: (expired) access token
123
+ - name: x-refresh-token
124
+ is_required: true
125
+ type: string
126
+ description: refresh token
127
+ response:
128
+ success:
129
+ - status_code: 200
130
+ example: auth-refreshtoken-200
131
+ fail:
132
+ - status_code: 401
133
+ description: |
134
+ - <code>x-access-token</code> or <code>x-refresh-token</code> is not provided.
135
+ - <code>x-access-token</code> or <code>x-refresh-token</code> is not valid(not issued by the server, or modified).
136
+ - <code>x-refresh-token</code> is banned.
137
+ - <code>x-access-token</code> and <code>x-refresh-token</code> are not matching.
138
+ ```
139
+
140
+ 5. Execute the python code below with Python 3:
141
+
142
+ ```python
143
+ import os
144
+
145
+ yaml_path = "_api"
146
+ html_path = "documents/_api_book_page"
147
+
148
+ if not os.path.exists(yaml_path):
149
+ os.mkdir(yaml_path)
150
+ if not os.path.exists(html_path):
151
+ os.mkdir(html_path)
152
+
153
+ for html in os.listdir(html_path):
154
+ os.remove(os.path.join(html_path, html))
155
+
156
+ yamls = sorted([os.path.splitext(x)[0] for x in os.listdir(yaml_path) if x.endswith(".yaml")])
157
+
158
+ for i, yaml in enumerate(yamls):
159
+ with open(os.path.join(html_path, f"{yaml}.html"), "w") as html:
160
+ html.write("---\n")
161
+
162
+ if i == 0:
163
+ redirect_from = "redirect_from:\n - /\n - docs/\n"
164
+ html.write(redirect_from)
165
+
166
+ html.write("---\n")
167
+ ```
168
+
169
+ 6. Execute:
170
+
171
+ $ bundle
172
+
173
+ Or install it yourself as:
174
+
175
+ $ gem install jekyll-hk-api-doc
176
+
177
+ ## Contributing
178
+
179
+ Bug reports and pull requests are welcome on GitHub at https://github.com/HeekangPark/jekyll-hk-api-doc.
180
+
181
+ ## Development
182
+
183
+ To set up your environment to develop this theme, run `bundle install`.
184
+
185
+ Your theme is setup just like a normal Jekyll site! To test your theme, run `bundle exec jekyll serve` and open your browser at `http://localhost:4000`. This starts a Jekyll server using your theme. Add pages, documents, data, etc. like normal to test your theme's contents. As you make modifications to your theme and to your content, your site will regenerate and you should see the changes in the browser after a refresh, just like normal.
186
+
187
+ When your theme is released, only the files in `_layouts`, `_includes`, `_sass` and `assets` tracked with Git will be bundled.
188
+ To add a custom directory to your theme-gem, please edit the regexp in `jekyll-hk-api-doc.gemspec` accordingly.
189
+
190
+ ## License
191
+
192
+ The theme is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -0,0 +1,240 @@
1
+ <div class="main-content">
2
+ <div class="yaml-name-area">
3
+ <h1 class="yaml-name">{{ yaml.name }}</h1>
4
+ <p class="yaml-description">{{ yaml.description | newline_to_br }}</p>
5
+ </div>
6
+
7
+ <div class="apis">
8
+ {% for api in yaml.apis %}
9
+ <div class="api">
10
+ <div class="api-name-area" id="api-{{ forloop.index }}">
11
+ <h2 class="api-name">{{ api.name }}</h2>
12
+ <p class="api-method api-method-{{ api.method | downcase }}">{{ api.method | upcase }}</p>
13
+ <p class="api-url-area"><span class="api-baseurl">{{ site.api_baseurl | escape }}</span><span class="api-url">{{ yaml.base_url | escape }}{{ api.url | escape }}</span></p>
14
+ </div>
15
+
16
+ <div class="api-description">{{ api.description | newline_to_br }}</div>
17
+
18
+ <div class="request-response-container">
19
+ <div class="btns">
20
+ <div class="btn request-btn selected">Request</div>
21
+ <div class="btn response-btn">Response</div>
22
+ </div>
23
+ <div class="request-response">
24
+ <div class="request selected">
25
+ {% if api.params.header %}
26
+ <p class="param-type">Headers</p>
27
+ <table>
28
+ <thead>
29
+ <tr>
30
+ <th class="param-name-col">Field</th>
31
+ <th class="param-datatype-col">Type</th>
32
+ <th class="param-description-col">Description</th>
33
+ </tr>
34
+ </thead>
35
+ <tbody>
36
+ {% for param in api.params.header %}
37
+ <tr>
38
+ <td class="param-name-col">
39
+ <p class="param-name">{{ param.name }}</p>
40
+ {% if param.is_required %}
41
+ <p class="param-is-required required">required</p>
42
+ {% else %}
43
+ <p class="param-is-required optional">optional</p>
44
+ {% endif %}
45
+ </td>
46
+ <td class="param-datatype-col"><p class="param-datatype">{{ param.type }}</p></td>
47
+ <td class="param-description-col"><p class="param-description">{{ param.description | newline_to_br }}</p></td>
48
+ </tr>
49
+ {% endfor %}
50
+ </tbody>
51
+ </table>
52
+ {% endif %}
53
+ {% if api.params.path %}
54
+ <p class="param-type">Path Parameters</p>
55
+ <table>
56
+ <thead>
57
+ <tr>
58
+ <th class="param-name-col">Field</th>
59
+ <th class="param-datatype-col">Type</th>
60
+ <th class="param-description-col">Description</th>
61
+ </tr>
62
+ </thead>
63
+ <tbody>
64
+ {% for param in api.params.path %}
65
+ <tr>
66
+ <td class="param-name-col">
67
+ <p class="param-name">{{ param.name }}</p>
68
+ {% if param.is_required %}
69
+ <p class="param-is-required required">required</p>
70
+ {% else %}
71
+ <p class="param-is-required optional">optional</p>
72
+ {% endif %}
73
+ </td>
74
+ <td class="param-datatype-col"><p class="param-datatype">{{ param.type }}</p></td>
75
+ <td class="param-description-col"><p class="param-description">{{ param.description | newline_to_br }}</p></td>
76
+ </tr>
77
+ {% endfor %}
78
+ </tbody>
79
+ </table>
80
+ {% endif %}
81
+ {% if api.params.query %}
82
+ <p class="param-type">Query Parameters</p>
83
+ <table>
84
+ <thead>
85
+ <tr>
86
+ <th class="param-name-col">Field</th>
87
+ <th class="param-datatype-col">Type</th>
88
+ <th class="param-description-col">Description</th>
89
+ </tr>
90
+ </thead>
91
+ <tbody>
92
+ {% for param in api.params.query %}
93
+ <tr>
94
+ <td class="param-name-col">
95
+ <p class="param-name">{{ param.name }}</p>
96
+ {% if param.is_required %}
97
+ <p class="param-is-required required">required</p>
98
+ {% else %}
99
+ <p class="param-is-required optional">optional</p>
100
+ {% endif %}
101
+ </td>
102
+ <td class="param-datatype-col"><p class="param-datatype">{{ param.type }}</p></td>
103
+ <td class="param-description-col"><p class="param-description">{{ param.description | newline_to_br }}</p></td>
104
+ </tr>
105
+ {% endfor %}
106
+ </tbody>
107
+ </table>
108
+ {% endif %}
109
+ {% if api.params.body %}
110
+ <p class="param-type">Body Parameters</p>
111
+ <table>
112
+ <thead>
113
+ <tr>
114
+ <th class="param-name-col">Field</th>
115
+ <th class="param-datatype-col">Type</th>
116
+ <th class="param-description-col">Description</th>
117
+ </tr>
118
+ </thead>
119
+ <tbody>
120
+ {% for param in api.params.body %}
121
+ <tr>
122
+ <td class="param-name-col">
123
+ <p class="param-name">{{ param.name }}</p>
124
+ {% if param.is_required %}
125
+ <p class="param-is-required required">required</p>
126
+ {% else %}
127
+ <p class="param-is-required optional">optional</p>
128
+ {% endif %}
129
+ </td>
130
+ <td class="param-datatype-col"><p class="param-datatype">{{ param.type }}</p></td>
131
+ <td class="param-description-col"><p class="param-description">{{ param.description | newline_to_br }}</p></td>
132
+ </tr>
133
+ {% endfor %}
134
+ </tbody>
135
+ </table>
136
+ {% endif %}
137
+ </div>
138
+
139
+ <div class="response not-selected">
140
+ {% if api.response.success %}
141
+ <p class="response-result">Success</p>
142
+ <div class="response-success">
143
+ {% for item in api.response.success %}
144
+ <div class="response-item">
145
+ <p class="status-code">
146
+ {{ item.status_code }}
147
+ {% if item.status_code == 200 %}
148
+ : Success
149
+ {% endif %}
150
+ </p>
151
+
152
+ {% if item.description %}
153
+ <p class="response-description">{{ item.description | newline_to_br }}</p>
154
+ {% endif %}
155
+
156
+ {% if item.example %}
157
+ <pre class="response-example" id="response-example-{{ item.example }}"></pre>
158
+ {% endif %}
159
+ </div>
160
+ {% endfor %}
161
+ </div>
162
+ {% endif %}
163
+
164
+ {% if api.response.fail %}
165
+ <p class="response-result">Fail</p>
166
+ <div class="response-fail">
167
+ {% for item in api.response.fail %}
168
+ <div class="response-item">
169
+ <p class="status-code">
170
+ {{ item.status_code }}
171
+ {% if item.status_code == 400 %}
172
+ : Bad Request
173
+ {% elsif item.status_code == 401 %}
174
+ : Unauthorized
175
+ {% elsif item.status_code == 401 %}
176
+ : Unauthorized
177
+ {% elsif item.status_code == 403 %}
178
+ : Forbidden
179
+ {% elsif item.status_code == 404 %}
180
+ : Not Found
181
+ {% endif %}
182
+ </p>
183
+
184
+ {% if item.description %}
185
+ <p class="response-description">{{ item.description | newline_to_br }}</p>
186
+ {% endif %}
187
+
188
+ {% if item.example %}
189
+ <pre class="response-example" id="response-example-{{ item.example }}"></pre>
190
+ {% endif %}
191
+ </div>
192
+ {% endfor %}
193
+ </div>
194
+ {% endif %}
195
+ </div>
196
+ </div>
197
+ </div>
198
+ </div>
199
+ {% endfor %}
200
+ </div>
201
+ </div>
202
+
203
+ <script>
204
+ $(".left-sidebar-content-toc-container .content-toc-container .apis .request-response-container .btns .btn.request-btn").click(function() {
205
+ $(this).addClass("selected");
206
+ $(this).siblings(".btn.response-btn").removeClass("selected");
207
+
208
+ var targets = $(this).parent(".btns").siblings(".request-response");
209
+
210
+ targets.children(".request").addClass("selected").removeClass("not-selected");
211
+ targets.children(".response").addClass("not-selected").removeClass("selected");
212
+ });
213
+
214
+ $(".left-sidebar-content-toc-container .content-toc-container .apis .request-response-container .btns .btn.response-btn").click(function() {
215
+ $(this).addClass("selected");
216
+ $(this).siblings(".btn.request-btn").removeClass("selected");
217
+
218
+ var targets = $(this).parent(".btns").siblings(".request-response");
219
+
220
+ targets.children(".request").addClass("not-selected").removeClass("selected");
221
+ targets.children(".response").addClass("selected").removeClass("not-selected");
222
+ });
223
+
224
+ $(document).ready(function() {
225
+ $(".left-sidebar-content-toc-container .content-toc-container .apis .request-response-container .request-response .response .response-example").each(function(idx, elem) {
226
+ var filename = $(this).attr("id").split("response-example-")[1];
227
+
228
+ $.ajax({
229
+ type: "GET",
230
+ url: `{{ site.baseurl }}{{ site.assets }}/api/examples/${filename}.json`,
231
+ context: this,
232
+ dataType: "html",
233
+ success: function(data) {
234
+ $(this).text(data);
235
+ hljs.highlightBlock($(this)[0]);
236
+ }
237
+ })
238
+ });
239
+ });
240
+ </script>
@@ -0,0 +1,24 @@
1
+ <head>
2
+ <meta charset="UTF-8">
3
+ <meta name="viewport" content="width=device-width, initial-scale=1,user-scalable=no">
4
+
5
+ <title>{{ site.title | append: " v" | append: site.version }}</title>
6
+
7
+ <meta name="author" content="{{ site.author | append: "(" | append: site.email | append: ")" }}">
8
+ <meta name="description" content="{{ site.description }}">
9
+
10
+ <!-- favicon -->
11
+ <link rel="shortcut icon" href="{{ site.baseurl }}/assets/favicon.ico"/>
12
+
13
+ <!-- jQuery -->
14
+ <script src="https://code.jquery.com/jquery-3.5.1.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>
15
+
16
+ <!-- highlight.js -->
17
+ <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/10.3.1/styles/arta.min.css">
18
+ <script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/10.3.1/highlight.min.js"></script>
19
+
20
+ <!-- fontawesome -->
21
+ <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css">
22
+
23
+ <link rel="stylesheet" href="{{ site.baseurl }}{{ site.assets }}/css/main.css" type="text/css">
24
+ </head>
@@ -0,0 +1,7 @@
1
+ <div class="left-sidebar hidden-when-sm-width">
2
+ {% assign sorted_api_book = api_book | sort %}
3
+ {% for api_group in sorted_api_book %}
4
+ {% assign api_group_name = api_group[0] | downcase %}
5
+ <a class="left-sidebar-item {% if api_group_name == filename %}active{% endif %}" href="{{ site.baseurl }}/{{ api_group_name }}">{{ api_group_name | capitalize }}</a>
6
+ {% endfor %}
7
+ </div>
@@ -0,0 +1,17 @@
1
+ <div class="toc-container">
2
+ <div class="toc">
3
+ <p class="toc-title">Contents</p>
4
+ {% for api in yaml.apis %}
5
+ <p class="toc-item"><span class="toc-api-method toc-api-method-{{ api.method | downcase }}">{{ api.method | upcase }}</span><a class="toc-api-name" href="#api-{{ forloop.index }}">{{ api.name }}</a></p>
6
+ {% endfor %}
7
+ </div>
8
+ </div>
9
+
10
+ <script>
11
+ $(document).ready(function() {
12
+ var toc = $(".left-sidebar-content-toc-container .content-toc-container .toc-container .toc");
13
+ $(".left-sidebar-content-toc-container .content-toc-container").scroll(function() {
14
+ toc.css("top", $(this).scrollTop() + "px");
15
+ })
16
+ })
17
+ </script>
@@ -0,0 +1,9 @@
1
+ <div class="top-navbar">
2
+ <p class="title">{{ site.title | upcase }} v{{ site.version }}</p>
3
+ <p class="menu-btn"><i class="fas fa-bars"></i></p>
4
+ </div>
5
+ <script>
6
+ $(".top-navbar-container .top-navbar .menu-btn i").click(function() {
7
+ $(".top-navbar-container .left-sidebar-content-toc-container .left-sidebar").toggleClass("hidden-when-sm-width");
8
+ })
9
+ </script>
data/_layouts/api.html ADDED
@@ -0,0 +1,22 @@
1
+ <!DOCTYPE html>
2
+ <html lang="ko">
3
+ {% include head.html %}
4
+
5
+ <body>
6
+ {% assign api_book = site.data %}
7
+ {% assign filename = page.title | downcase %}
8
+ {% assign yaml = api_book[filename] %}
9
+
10
+ <div class="top-navbar-container">
11
+ {% include top_navbar.html %}
12
+
13
+ <div class="left-sidebar-content-toc-container">
14
+ {% include left_sidebar.html %}
15
+ <div class="content-toc-container">
16
+ {% include api_main_content.html %}
17
+ {% include toc.html %}
18
+ </div>
19
+ </div>
20
+ </div>
21
+ </body>
22
+ </html>
@@ -0,0 +1,369 @@
1
+ .main-content {
2
+ $color-description: #555555;
3
+ $line-height: 1.6;
4
+
5
+ padding: {
6
+ top: 1em;
7
+ bottom: 1em;
8
+ left: 2em;
9
+ right: 2em;
10
+ }
11
+
12
+ width: 100%;
13
+ max-width: 100%;
14
+ min-width: 100%;
15
+
16
+ box-sizing: border-box;
17
+
18
+ .yaml-name-area {
19
+ padding: {
20
+ top: 0.2em;
21
+ bottom: 0.5em;
22
+ }
23
+ border: {
24
+ bottom: 1px solid #dee2e6;
25
+ }
26
+
27
+ .yaml-description {
28
+ margin: {
29
+ top: 0.3em;
30
+ }
31
+
32
+ color: $color-description;
33
+ }
34
+ }
35
+
36
+ code {
37
+ color: #c7254e;
38
+ padding: {
39
+ top: 0.2em;
40
+ bottom: 0.2em;
41
+ left: 0.4em;
42
+ right: 0.4em;
43
+ }
44
+ border-radius: 4px;
45
+ background-color: #f9f2f4;
46
+ }
47
+
48
+ .apis {
49
+ width: 100%;
50
+ max-width: 100%;
51
+ min-width: 100%;
52
+
53
+ .api {
54
+ margin: {
55
+ top: 2em;
56
+ }
57
+
58
+ width: 100%;
59
+ max-width: 100%;
60
+ min-width: 100%;
61
+
62
+ .api-name-area {
63
+ display: grid;
64
+ grid-template-columns: 1fr auto;
65
+ grid-template-rows: 1fr 1fr;
66
+ align-items: center;
67
+
68
+ .api-name {
69
+ grid-row: 1/2;
70
+ grid-column: 1/2;
71
+ }
72
+
73
+ .api-method {
74
+ grid-row: 1/2;
75
+ grid-column: 2/3;
76
+ padding: {
77
+ top: 0.3em;
78
+ bottom: 0.3em;
79
+ left: 0.5em;
80
+ right: 0.5em;
81
+ }
82
+ border-radius: 0.2em;
83
+ color: #ffffff;
84
+ font-family: "Ubuntu Mono", "Nanum Gothic Coding", monospace;
85
+
86
+ &.api-method-get {
87
+ background-color: #3884ff;
88
+ }
89
+
90
+ &.api-method-post {
91
+ background-color: #26cb7c;
92
+ }
93
+
94
+ &.api-method-put {
95
+ background-color: #f77d05;
96
+ }
97
+
98
+ &.api-method-delete {
99
+ background-color: #ff4642;
100
+ }
101
+
102
+ &.api-method-patch {
103
+ background-color: #03d1eb;
104
+ }
105
+
106
+ &.api-method-head {
107
+ background-color: #a44eed;
108
+ }
109
+
110
+ &.api-method-options {
111
+ background-color: #ffd139;
112
+ }
113
+ }
114
+
115
+ .api-url-area {
116
+ grid-row: 2/3;
117
+ grid-column: 1/3;
118
+ background-color: #F5F7F9;
119
+ margin: {
120
+ top: 0.2em;
121
+ }
122
+ padding: {
123
+ top: 0.8em;
124
+ bottom: 0.8em;
125
+ left: 0.8em;
126
+ right: 0.8em;
127
+ }
128
+ border-radius: 4px;
129
+ font-family: "Ubuntu Mono", "Nanum Gothic Coding", monospace;
130
+
131
+ .api-baseurl {
132
+ color: #74818D;
133
+ }
134
+
135
+ .api-url {
136
+ color: #000000;
137
+ }
138
+ }
139
+ }
140
+
141
+ .api-description {
142
+ margin: {
143
+ top: 0.5em;
144
+ }
145
+
146
+ line-height: $line-height;
147
+
148
+ color: $color-description;
149
+ }
150
+
151
+ .request-response-container {
152
+ $border: 1px solid #ddd;
153
+ $border-radius: 4px;
154
+
155
+ width: 100%;
156
+ max-width: 100%;
157
+ min-width: 100%;
158
+
159
+ .btns {
160
+ margin: {
161
+ top: 1em;
162
+ }
163
+
164
+ border: {
165
+ bottom: $border;
166
+ }
167
+ box-sizing: border-box;
168
+
169
+ .btn {
170
+ display: inline-block;
171
+ margin: {
172
+ bottom: -1px;
173
+ right: 1px;
174
+ }
175
+ padding: {
176
+ top: 0.8em;
177
+ bottom: 0.8em;
178
+ left: 1em;
179
+ right: 1em;
180
+ }
181
+ box-sizing: border-box;
182
+ border-top-left-radius: $border-radius;
183
+ border-top-right-radius: $border-radius;
184
+
185
+ cursor: pointer;
186
+
187
+ &.selected {
188
+ border: $border;
189
+ border-bottom-color: #fff;
190
+ }
191
+ }
192
+ }
193
+
194
+ .request-response {
195
+ border: {
196
+ left: $border;
197
+ right: $border;
198
+ bottom: $border;
199
+ }
200
+
201
+ border-bottom-left-radius: $border-radius;
202
+ border-bottom-right-radius: $border-radius;
203
+
204
+ padding: {
205
+ top: 0.8em;
206
+ bottom: 0.8em;
207
+ left: 1em;
208
+ right: 1em;
209
+ }
210
+
211
+ .selected {
212
+ display: block;
213
+ }
214
+
215
+ .not-selected {
216
+ display: none;
217
+ }
218
+
219
+ .request {
220
+ .param-type {
221
+ margin: {
222
+ top: 1em;
223
+ bottom: 0.5em;
224
+ }
225
+
226
+ &:first-child {
227
+ margin: {
228
+ top: 0;
229
+ }
230
+ }
231
+ }
232
+
233
+ table {
234
+ width: 100%;
235
+ border-collapse: separate;
236
+
237
+ border: $border;
238
+ border-radius: $border-radius;
239
+
240
+ thead {
241
+ display: none;
242
+ }
243
+
244
+ tbody {
245
+ th, tr {
246
+ td {
247
+ padding: {
248
+ top: 0.5em;
249
+ bottom: 0.5em;
250
+ left: 0.5em;
251
+ right: 0.5em;
252
+ }
253
+
254
+ &.param-name-col {
255
+ width: 25%;
256
+
257
+ .param-is-required {
258
+ font-size: 0.8em;
259
+
260
+ &.required {
261
+ color: #ff4642;
262
+ }
263
+
264
+ &.optional {
265
+ color: #555555;
266
+ }
267
+ }
268
+ }
269
+
270
+ &.param-datatype-col {
271
+ width: 15%;
272
+ }
273
+
274
+ &.param-description-col {
275
+ width: 60%;
276
+ .param-description {
277
+ color: $color-description;
278
+ line-height: $line-height;
279
+ }
280
+ }
281
+ }
282
+ }
283
+ }
284
+ }
285
+ }
286
+
287
+ .response {
288
+ .response-result {
289
+ margin: {
290
+ top: 1em;
291
+ bottom: 0.5em;
292
+ }
293
+
294
+ &:first-child {
295
+ margin: {
296
+ top: 0;
297
+ }
298
+ }
299
+ }
300
+ .response-success, .response-fail {
301
+ border: $border;
302
+ border-radius: $border-radius;
303
+
304
+ padding: {
305
+ top: 0.6em;
306
+ bottom: 0.6em;
307
+ left: 0.6em;
308
+ right: 0.6em;
309
+ }
310
+
311
+ .response-item {
312
+ margin: {
313
+ top: 1.2em;
314
+ }
315
+
316
+ &:first-child {
317
+ margin: {
318
+ top: 0;
319
+ }
320
+ }
321
+
322
+ .response-description {
323
+ margin: {
324
+ top: 0.5em;
325
+ left: 1em;
326
+ right: 1em;
327
+ }
328
+ color: $color-description;
329
+ line-height: $line-height;
330
+ }
331
+
332
+ .response-example {
333
+ margin: {
334
+ top: 0.5em;
335
+ left: 1em;
336
+ right: 1em;
337
+ }
338
+
339
+ padding: {
340
+ top: 0.5em;
341
+ bottom: 0.5em;
342
+ left: 0.5em;
343
+ right: 0.5em;
344
+ }
345
+
346
+ border-radius: $border-radius;
347
+ line-height: 1.2;
348
+
349
+ overflow: auto;
350
+
351
+ }
352
+ }
353
+ }
354
+
355
+ .response-success .status-code::before {
356
+ content: "●";
357
+ color: #26cb7c;
358
+ }
359
+
360
+ .response-fail .status-code::before {
361
+ content: "●";
362
+ color: #ff4642;
363
+ }
364
+ }
365
+ }
366
+ }
367
+ }
368
+ }
369
+ }
@@ -0,0 +1,30 @@
1
+ .left-sidebar {
2
+ padding: {
3
+ top: 1em;
4
+ bottom: 1em;
5
+ left: 2em;
6
+ right: 2em;
7
+ }
8
+ background-color: #f8f9fa;
9
+ overflow-y: auto;
10
+
11
+ .left-sidebar-item {
12
+ display: block;
13
+ font-weight: 700;
14
+ color: #333;
15
+ text-decoration: none;
16
+ margin: {
17
+ top: 1em;
18
+ }
19
+
20
+ &:first-child {
21
+ margin: {
22
+ top: 0;
23
+ }
24
+ }
25
+
26
+ &.active {
27
+ color: #007bff
28
+ }
29
+ }
30
+ }
@@ -0,0 +1,74 @@
1
+ .toc-container {
2
+ position: relative;
3
+
4
+ .toc {
5
+ position: absolute;
6
+ top: 0;
7
+
8
+ padding: {
9
+ top: 1em;
10
+ bottom: 1em;
11
+ left: 2em;
12
+ right: 2em;
13
+ }
14
+
15
+ .toc-title {
16
+ font-weight: bold;
17
+ }
18
+
19
+ .toc-item {
20
+ margin: {
21
+ top: 1em;
22
+ }
23
+ line-height: 1.5;
24
+
25
+ .toc-api-method {
26
+ padding: {
27
+ top: 0.2em;
28
+ bottom: 0.2em;
29
+ left: 0.3em;
30
+ right: 0.3em;
31
+ }
32
+ margin: {
33
+ right: 5px;
34
+ }
35
+ border-radius: 0.2em;
36
+ color: #ffffff;
37
+ font-family: "Ubuntu Mono", "Nanum Gothic Coding", monospace;
38
+
39
+ &.toc-api-method-get {
40
+ background-color: #3884ff;
41
+ }
42
+
43
+ &.toc-api-method-post {
44
+ background-color: #26cb7c;
45
+ }
46
+
47
+ &.toc-api-method-put {
48
+ background-color: #f77d05;
49
+ }
50
+
51
+ &.toc-api-method-delete {
52
+ background-color: #ff4642;
53
+ }
54
+
55
+ &.toc-api-method-patch {
56
+ background-color: #03d1eb;
57
+ }
58
+
59
+ &.toc-api-method-head {
60
+ background-color: #a44eed;
61
+ }
62
+
63
+ &.toc-api-method-options {
64
+ background-color: #ffd139;
65
+ }
66
+ }
67
+
68
+ .toc-api-name {
69
+ color: inherit;
70
+ text-decoration: inherit;
71
+ }
72
+ }
73
+ }
74
+ }
@@ -0,0 +1,18 @@
1
+ .top-navbar {
2
+ padding: 1em;
3
+ background-color: #343a40;
4
+ color: #fff;
5
+ display: grid;
6
+ grid-template-columns: 1fr;
7
+
8
+ .title {
9
+ font-size: 1em;
10
+ display: inline-block;
11
+ }
12
+
13
+ .menu-btn {
14
+ cursor: pointer;
15
+ display: none;
16
+ }
17
+ }
18
+
@@ -0,0 +1,117 @@
1
+ @import url('https://fonts.googleapis.com/css2?family=Nanum+Gothic:wght@400;700;800&family=Ubuntu+Mono:ital,wght@0,400;0,700;1,400;1,700&display=swap');
2
+
3
+ $screen-width-lg: 1200px;
4
+ $screen-width-md: 800px;
5
+ $screen-width-sm: 600px;
6
+
7
+ html, body, div, span, p, nav,
8
+ h1, h2, h3, h4, h5, h6, strong, small, b, u, i,
9
+ ul, ol, li, a, img, figure,
10
+ table, thead, tbody, tfoot, th, tr, td,
11
+ pre, blockquote {
12
+ margin: 0;
13
+ padding: 0;
14
+ border: 0;
15
+ }
16
+
17
+ html {
18
+ font-family: "Nanum Gothic", sans-serif;
19
+ word-break: break-all;
20
+ }
21
+
22
+ pre, code {
23
+ font-family: "Ubuntu Mono", "Nanum Gothic Coding", monospace;
24
+ }
25
+
26
+ html, body {
27
+ height: 100%;
28
+ max-height: 100%;
29
+ min-height: 100%;
30
+ width: 100%;
31
+ max-width: 100%;
32
+ min-width: 100%;
33
+ overflow-y: hidden;
34
+ }
35
+
36
+ .top-navbar-container {
37
+ height: 100%;
38
+ max-height: 100%;
39
+ min-height: 100%;
40
+ width: 100%;
41
+ max-width: 100%;
42
+ min-width: 100%;
43
+ display: grid;
44
+ grid-template-rows: auto 1fr;
45
+ overflow-y: hidden;
46
+
47
+ @import "include.top-navbar";
48
+
49
+ .left-sidebar-content-toc-container {
50
+ display: grid;
51
+ grid-template-columns: 250px 1fr;
52
+
53
+ overflow-y: hidden;
54
+
55
+ @import "include.left-sidebar";
56
+
57
+ .content-toc-container {
58
+ display: grid;
59
+ grid-template-columns: 1fr 300px;
60
+ overflow-y: auto;
61
+
62
+ @import "include.api_main_content";
63
+ @import "include.toc";
64
+ }
65
+
66
+ @media screen and (max-width: $screen-width-lg) {
67
+ .content-toc-container {
68
+ grid-template-columns: 1fr;
69
+
70
+ .toc-container {
71
+ display: none;
72
+ }
73
+ }
74
+ }
75
+ }
76
+
77
+ @media screen and (max-width: $screen-width-md) {
78
+ .left-sidebar-content-toc-container {
79
+ grid-template-columns: 180px 1fr;
80
+ }
81
+ }
82
+
83
+ @media screen and (max-width: $screen-width-sm) {
84
+ .top-navbar {
85
+ grid-template-columns: 1fr auto;
86
+
87
+ .menu-btn {
88
+ display: block;
89
+ }
90
+ }
91
+
92
+ .left-sidebar-content-toc-container {
93
+ grid-template-columns: 1fr;
94
+ grid-template-rows: auto auto;
95
+
96
+ .left-sidebar {
97
+ grid-row: 1/2;
98
+ grid-column: 1/2;
99
+
100
+ &.hidden-when-sm-width {
101
+ display: none;
102
+ }
103
+ }
104
+
105
+ .content-toc-container {
106
+ grid-row: 2/3;
107
+ grid-column: 1/2;
108
+ }
109
+ }
110
+ }
111
+ }
112
+
113
+ @media screen and (max-width: $screen-width-md) {
114
+ html {
115
+ font-size: 0.8em;
116
+ }
117
+ }
@@ -0,0 +1,5 @@
1
+ ---
2
+ ---
3
+ @charset "utf-8";
4
+
5
+ @import "layout.default";
Binary file
metadata ADDED
@@ -0,0 +1,100 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jekyll-hk-api-doc
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Heekang Park
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2021-01-14 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: jekyll
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '3.9'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '3.9'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.16'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.16'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '12.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '12.0'
55
+ description:
56
+ email:
57
+ - park.heekang33@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - LICENSE.txt
63
+ - README.md
64
+ - _includes/api_main_content.html
65
+ - _includes/head.html
66
+ - _includes/left_sidebar.html
67
+ - _includes/toc.html
68
+ - _includes/top_navbar.html
69
+ - _layouts/api.html
70
+ - _sass/include.api_main_content.scss
71
+ - _sass/include.left-sidebar.scss
72
+ - _sass/include.toc.scss
73
+ - _sass/include.top-navbar.scss
74
+ - _sass/layout.default.scss
75
+ - assets/css/main.scss
76
+ - assets/favicon.ico
77
+ homepage: https://github.com/HeekangPark/jekyll-hk-api-doc
78
+ licenses:
79
+ - MIT
80
+ metadata: {}
81
+ post_install_message:
82
+ rdoc_options: []
83
+ require_paths:
84
+ - lib
85
+ required_ruby_version: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ required_rubygems_version: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ requirements: []
96
+ rubygems_version: 3.1.4
97
+ signing_key:
98
+ specification_version: 4
99
+ summary: A Simple API Doc with YAML powered by Jekyll
100
+ test_files: []