rapipdf 2.1.1 → 3.0.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.
- package/README.md +66 -14
- package/dist/chunks/generate-BQLGaRvK.js +386 -0
- package/dist/chunks/generate-BQLGaRvK.js.LICENSE.txt +224 -0
- package/dist/chunks/localize-CRvDVkIz.js +8 -0
- package/dist/node.js +13096 -0
- package/dist/node.js.LICENSE.txt +195 -0
- package/dist/rapipdf-min.js +352 -90
- package/dist/rapipdf-min.js.LICENSE.txt +224 -0
- package/dist/rapipdf.js +69 -0
- package/package.json +58 -52
- package/src/node.d.ts +82 -0
- package/src/rapipdf.d.ts +50 -0
- package/.babelrc +0 -11
- package/.eslintrc +0 -28
- package/dist/index.html +0 -48
- package/dist/index.html.gz +0 -0
- package/dist/rapipdf-min.js.gz +0 -0
- package/dist/rapipdf-min.js.map +0 -1
- package/dist/rapipdf-min.js.map.gz +0 -0
- package/dist/report.html +0 -67
- package/docs/examples/example1.html +0 -68
- package/docs/examples/list.html +0 -27
- package/docs/examples/rapidoc-regular.woff2 +0 -0
- package/docs/examples/rapidoc-semi-bold.woff2 +0 -0
- package/docs/examples/roboto-mono-bold.woff2 +0 -0
- package/docs/examples/roboto-mono-regular.woff2 +0 -0
- package/docs/highlight/CHANGES.md +0 -1803
- package/docs/highlight/LICENSE +0 -24
- package/docs/highlight/README.md +0 -188
- package/docs/highlight/README.ru.md +0 -142
- package/docs/highlight/highlight.pack.js +0 -2
- package/docs/highlight/styles/a11y-dark.css +0 -99
- package/docs/highlight/styles/a11y-light.css +0 -99
- package/docs/highlight/styles/agate.css +0 -108
- package/docs/highlight/styles/an-old-hope.css +0 -89
- package/docs/highlight/styles/androidstudio.css +0 -66
- package/docs/highlight/styles/arduino-light.css +0 -88
- package/docs/highlight/styles/arta.css +0 -73
- package/docs/highlight/styles/ascetic.css +0 -45
- package/docs/highlight/styles/atelier-cave-dark.css +0 -83
- package/docs/highlight/styles/atelier-cave-light.css +0 -85
- package/docs/highlight/styles/atelier-dune-dark.css +0 -69
- package/docs/highlight/styles/atelier-dune-light.css +0 -69
- package/docs/highlight/styles/atelier-estuary-dark.css +0 -84
- package/docs/highlight/styles/atelier-estuary-light.css +0 -84
- package/docs/highlight/styles/atelier-forest-dark.css +0 -69
- package/docs/highlight/styles/atelier-forest-light.css +0 -69
- package/docs/highlight/styles/atelier-heath-dark.css +0 -69
- package/docs/highlight/styles/atelier-heath-light.css +0 -69
- package/docs/highlight/styles/atelier-lakeside-dark.css +0 -69
- package/docs/highlight/styles/atelier-lakeside-light.css +0 -69
- package/docs/highlight/styles/atelier-plateau-dark.css +0 -84
- package/docs/highlight/styles/atelier-plateau-light.css +0 -84
- package/docs/highlight/styles/atelier-savanna-dark.css +0 -84
- package/docs/highlight/styles/atelier-savanna-light.css +0 -84
- package/docs/highlight/styles/atelier-seaside-dark.css +0 -69
- package/docs/highlight/styles/atelier-seaside-light.css +0 -69
- package/docs/highlight/styles/atelier-sulphurpool-dark.css +0 -69
- package/docs/highlight/styles/atelier-sulphurpool-light.css +0 -69
- package/docs/highlight/styles/atom-one-dark-reasonable.css +0 -77
- package/docs/highlight/styles/atom-one-dark.css +0 -96
- package/docs/highlight/styles/atom-one-light.css +0 -96
- package/docs/highlight/styles/brown-paper.css +0 -64
- package/docs/highlight/styles/brown-papersq.png +0 -0
- package/docs/highlight/styles/codepen-embed.css +0 -60
- package/docs/highlight/styles/color-brewer.css +0 -71
- package/docs/highlight/styles/darcula.css +0 -77
- package/docs/highlight/styles/dark.css +0 -63
- package/docs/highlight/styles/darkula.css +0 -6
- package/docs/highlight/styles/default.css +0 -99
- package/docs/highlight/styles/docco.css +0 -97
- package/docs/highlight/styles/dracula.css +0 -76
- package/docs/highlight/styles/far.css +0 -71
- package/docs/highlight/styles/foundation.css +0 -88
- package/docs/highlight/styles/github-gist.css +0 -71
- package/docs/highlight/styles/github.css +0 -99
- package/docs/highlight/styles/gml.css +0 -78
- package/docs/highlight/styles/googlecode.css +0 -89
- package/docs/highlight/styles/grayscale.css +0 -101
- package/docs/highlight/styles/gruvbox-dark.css +0 -108
- package/docs/highlight/styles/gruvbox-light.css +0 -108
- package/docs/highlight/styles/hopscotch.css +0 -83
- package/docs/highlight/styles/hybrid.css +0 -102
- package/docs/highlight/styles/idea.css +0 -97
- package/docs/highlight/styles/ir-black.css +0 -73
- package/docs/highlight/styles/isbl-editor-dark.css +0 -112
- package/docs/highlight/styles/isbl-editor-light.css +0 -112
- package/docs/highlight/styles/kimbie.dark.css +0 -74
- package/docs/highlight/styles/kimbie.light.css +0 -74
- package/docs/highlight/styles/lightfair.css +0 -87
- package/docs/highlight/styles/magula.css +0 -70
- package/docs/highlight/styles/mono-blue.css +0 -59
- package/docs/highlight/styles/monokai-sublime.css +0 -83
- package/docs/highlight/styles/monokai.css +0 -70
- package/docs/highlight/styles/nord.css +0 -309
- package/docs/highlight/styles/obsidian.css +0 -88
- package/docs/highlight/styles/ocean.css +0 -74
- package/docs/highlight/styles/paraiso-dark.css +0 -72
- package/docs/highlight/styles/paraiso-light.css +0 -72
- package/docs/highlight/styles/pojoaque.css +0 -83
- package/docs/highlight/styles/pojoaque.jpg +0 -0
- package/docs/highlight/styles/purebasic.css +0 -96
- package/docs/highlight/styles/qtcreator_dark.css +0 -83
- package/docs/highlight/styles/qtcreator_light.css +0 -83
- package/docs/highlight/styles/railscasts.css +0 -106
- package/docs/highlight/styles/rainbow.css +0 -85
- package/docs/highlight/styles/routeros.css +0 -108
- package/docs/highlight/styles/school-book.css +0 -72
- package/docs/highlight/styles/school-book.png +0 -0
- package/docs/highlight/styles/shades-of-purple.css +0 -97
- package/docs/highlight/styles/solarized-dark.css +0 -84
- package/docs/highlight/styles/solarized-light.css +0 -84
- package/docs/highlight/styles/sunburst.css +0 -102
- package/docs/highlight/styles/tomorrow-night-blue.css +0 -75
- package/docs/highlight/styles/tomorrow-night-bright.css +0 -74
- package/docs/highlight/styles/tomorrow-night-eighties.css +0 -74
- package/docs/highlight/styles/tomorrow-night.css +0 -75
- package/docs/highlight/styles/tomorrow.css +0 -72
- package/docs/highlight/styles/vs.css +0 -68
- package/docs/highlight/styles/vs2015.css +0 -115
- package/docs/highlight/styles/xcode.css +0 -104
- package/docs/highlight/styles/xt256.css +0 -92
- package/docs/highlight/styles/zenburn.css +0 -80
- package/docs/images/console.svg +0 -12
- package/docs/images/dark_ss.png +0 -0
- package/docs/images/easy.svg +0 -14
- package/docs/images/fast.svg +0 -8
- package/docs/images/gears.svg +0 -11
- package/docs/images/light_ss.png +0 -0
- package/docs/images/logo.png +0 -0
- package/docs/images/love.svg +0 -8
- package/docs/images/mask.svg +0 -16
- package/docs/images/mouse.svg +0 -7
- package/docs/images/pdf_sample1.png +0 -0
- package/docs/images/pdf_sample2.png +0 -0
- package/docs/images/webcomponent.svg +0 -13
- package/docs/index.css +0 -254
- package/docs/index.html +0 -376
- package/docs/rapipdf-min.js +0 -95
- package/docs/specs/allof-primitives.json +0 -80
- package/docs/specs/allof.json +0 -73
- package/docs/specs/anyof.json +0 -84
- package/docs/specs/basic.json +0 -75
- package/docs/specs/bitbucket.json +0 -12916
- package/docs/specs/data-types.yaml +0 -168
- package/docs/specs/gcloud.json +0 -1347
- package/docs/specs/no-server.json +0 -1
- package/docs/specs/oneof.json +0 -64
- package/docs/specs/petstore.json +0 -1042
- package/docs/specs/petstore_extended.yaml +0 -889
- package/docs/specs/temp.json +0 -53
- package/docs/specs/test-specs/large-models.json +0 -5998
- package/docs/specs/test-specs/long-descriptions.json +0 -5443
- package/docs/specs/test-specs/long-paths.json +0 -9562
- package/docs/specs/test-specs/oneof-allof-nested.yaml +0 -105
- package/docs/specs/test-specs/partial-spec-main.json +0 -29
- package/docs/specs/test-specs/partial.json +0 -17
- package/docs/specs/test-specs/petstore_complex_request.yaml +0 -335
- package/docs/specs/test-specs/petstore_experimental.yaml +0 -167
- package/docs/specs/test-specs/xxx-of-with-primitives-and-recursive-model.yaml +0 -952
- package/docs/welcome.html +0 -369
- package/index.html +0 -48
- package/logo.png +0 -0
- package/src/index.js +0 -3
- package/src/markdown.js +0 -120
- package/src/object-tree-gen.js +0 -370
- package/src/pdf-gen.js +0 -113
- package/src/pdf-parts-gen.js +0 -488
- package/src/rapipdf.js +0 -246
- package/src/spec-parser.js +0 -162
- package/src/table-layouts.js +0 -35
- package/src/vfs_fonts.js +0 -7
- package/webpack.config.js +0 -118
package/docs/welcome.html
DELETED
|
@@ -1,369 +0,0 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8">
|
|
5
|
-
<meta name="viewport" content="width=device-width, minimum-scale=1, initial-scale=1, user-scalable=yes">
|
|
6
|
-
<meta name="description" content="RapiPdf is Web Component based Swagger & OpenAPI Spec to PDF generator">
|
|
7
|
-
<meta name="keywords" content="RapiPdf, RapiDoc, ReDoc, Swagger, SwaggerUI, Custom Element, Web Component, OpenAPI, REST">
|
|
8
|
-
|
|
9
|
-
<link rel="shortcut icon" type="image/png" href="./images/logo.png"/>
|
|
10
|
-
|
|
11
|
-
<!-- Global site tag (gtag.js) - Google Analytics -->
|
|
12
|
-
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-132775238-2"></script>
|
|
13
|
-
<script>
|
|
14
|
-
window.dataLayer = window.dataLayer || [];
|
|
15
|
-
function gtag(){dataLayer.push(arguments);}
|
|
16
|
-
gtag('js', new Date());
|
|
17
|
-
|
|
18
|
-
gtag('config', 'UA-132775238-2');
|
|
19
|
-
</script>
|
|
20
|
-
|
|
21
|
-
<!-- Fonts -->
|
|
22
|
-
<link href="https://fonts.googleapis.com/css?family=Roboto+Mono:400,700" rel="stylesheet">
|
|
23
|
-
<link href="https://fonts.googleapis.com/css?family=Varela+Round" rel="stylesheet">
|
|
24
|
-
|
|
25
|
-
<!-- Code Highlight -->
|
|
26
|
-
<link rel="stylesheet" href="./highlight/styles/zenburn.css">
|
|
27
|
-
<script src="./highlight/highlight.pack.js"></script>
|
|
28
|
-
<script>hljs.initHighlightingOnLoad();</script>
|
|
29
|
-
|
|
30
|
-
<script type="text/javascript" src="rapipdf-min.js" defer></script>
|
|
31
|
-
|
|
32
|
-
<link rel="stylesheet" href="index.css">
|
|
33
|
-
|
|
34
|
-
<title>RapiPDF - Web Component based Swagger & OpenAPI PDF Generator</title>
|
|
35
|
-
</head>
|
|
36
|
-
|
|
37
|
-
<body>
|
|
38
|
-
<div class="banner container" id="banner">
|
|
39
|
-
<div class="header">
|
|
40
|
-
<img class="logo" src="./images/logo.png" style="width:48px;height:48px;margin-right:10px;" />
|
|
41
|
-
<div class="product-name"><rapi-pdf></div>
|
|
42
|
-
<div class="menu" style="flex:1"></div>
|
|
43
|
-
<nav class="menu" onclick="goToSection(event)">
|
|
44
|
-
<a class="menu-item" href="#features"> Features </a>
|
|
45
|
-
<a class="menu-item" href="#qstart"> Quick Start </a>
|
|
46
|
-
<a class="menu-item" href="#api"> API </a>
|
|
47
|
-
<a class="menu-item" data-action="url" href="https://mrin9.github.io/RapiDoc/"> RapiDoc </a>
|
|
48
|
-
<a class="menu-item" data-action="git" href="https://github.com/mrin9/RapiPdf"> GitHub </a>
|
|
49
|
-
</nav>
|
|
50
|
-
</div>
|
|
51
|
-
<div>
|
|
52
|
-
<div class="banner-content">
|
|
53
|
-
<h1 class="banner-title">Web Component to generate PDF from OpenAPI Spec</h1>
|
|
54
|
-
<div class="banner-content-inner">
|
|
55
|
-
<p style="font-size:18px">Create beautiful, customizable API documentation in PDF format from your OpenAPI Specification</p>
|
|
56
|
-
</div>
|
|
57
|
-
</div>
|
|
58
|
-
</div>
|
|
59
|
-
<div style="display:flex; justify-content: center;">
|
|
60
|
-
<div style="display:block">
|
|
61
|
-
<img class="screenshot shadow3" src="./images/pdf_sample1.png" />
|
|
62
|
-
</div>
|
|
63
|
-
</div>
|
|
64
|
-
</div>
|
|
65
|
-
<div class="features container" id="features">
|
|
66
|
-
|
|
67
|
-
<div class="feature">
|
|
68
|
-
<object type="image/svg+xml" data="./images/webcomponent.svg" style="width:64px; height:64px;"> </object>
|
|
69
|
-
<div class="feature-info">
|
|
70
|
-
<div class="feature-title"> Web Component Standard</div>
|
|
71
|
-
<div class="feature-descr">
|
|
72
|
-
Free of any frameworks, setups, configs, build steps or packaging.
|
|
73
|
-
Can be used with any framework or just with vanilla javascript
|
|
74
|
-
</div>
|
|
75
|
-
</div>
|
|
76
|
-
</div>
|
|
77
|
-
|
|
78
|
-
<div class="feature">
|
|
79
|
-
<object type="image/svg+xml" data="./images/easy.svg" style="width:64px; height:64px;"> </object>
|
|
80
|
-
<div class="feature-info">
|
|
81
|
-
<div class="feature-title"> Easy Usage</div>
|
|
82
|
-
<div class="feature-descr">
|
|
83
|
-
Use It just like any other HTML Tag, use its various attributes to customize the generation of your PDF.
|
|
84
|
-
Basic knowledge of HTML is all that's required
|
|
85
|
-
</div>
|
|
86
|
-
</div>
|
|
87
|
-
</div>
|
|
88
|
-
|
|
89
|
-
<div class="feature">
|
|
90
|
-
<object type="image/svg+xml" data="./images/mask.svg" style="width:64px; height:64px;"> </object>
|
|
91
|
-
<div class="feature-info">
|
|
92
|
-
<div class="feature-title">Customizable</div>
|
|
93
|
-
<div class="feature-descr">
|
|
94
|
-
Change font colors to match your brand colors.
|
|
95
|
-
Pick and choose the sections from the API Spec that you want to include in the PDF.
|
|
96
|
-
</div>
|
|
97
|
-
</div>
|
|
98
|
-
</div>
|
|
99
|
-
|
|
100
|
-
<div class="feature">
|
|
101
|
-
<object type="image/svg+xml" data="./images/gears.svg" style="width:64px; height:64px;"> </object>
|
|
102
|
-
<div class="feature-info">
|
|
103
|
-
<div class="feature-title"> Seamlessly interoperable</div>
|
|
104
|
-
<div class="feature-descr">
|
|
105
|
-
Loved by tech writers, designers, dev-ops, testers and developers alike,
|
|
106
|
-
due to its simplicity, interoperability and powerful features.
|
|
107
|
-
</div>
|
|
108
|
-
</div>
|
|
109
|
-
</div>
|
|
110
|
-
|
|
111
|
-
</div>
|
|
112
|
-
|
|
113
|
-
<div id="qstart" class="qstart container">
|
|
114
|
-
<div style="display:flex; flex-direction: column; ">
|
|
115
|
-
<h2> Quickstart & Demo</h2>
|
|
116
|
-
Just copy the below code and save it in an html file. Then open it using a browser
|
|
117
|
-
|
|
118
|
-
<pre class="shadow code-block"><code class="html" style="border-radius:4px">
|
|
119
|
-
<!doctype html>
|
|
120
|
-
<html>
|
|
121
|
-
<head>
|
|
122
|
-
<script src="https://unpkg.com/rapipdf/dist/rapipdf-min.js"></script>
|
|
123
|
-
</head>
|
|
124
|
-
<body>
|
|
125
|
-
<rapi-pdf
|
|
126
|
-
style = "width:700px; height:40px; font-size:18px;"
|
|
127
|
-
spec-url = "https://mrin9.github.io/RapiPdf/examples/specs/petstore.json"
|
|
128
|
-
button-bg = "#b44646"
|
|
129
|
-
> </rapi-pdf>
|
|
130
|
-
</body>
|
|
131
|
-
</html>
|
|
132
|
-
</code></pre>
|
|
133
|
-
|
|
134
|
-
<div> Go ahead, provide your Open API spec and click GENERATE PDF !!! </div>
|
|
135
|
-
<rapi-pdf id='rapipdf' style="width:730px; height:40px; font-size:18px;"
|
|
136
|
-
spec-url="https://mrin9.github.io/RapiPdf/specs/petstore.json"
|
|
137
|
-
button-bg="#b44646"
|
|
138
|
-
pdf-title="API Reference"
|
|
139
|
-
> </rapi-pdf>
|
|
140
|
-
|
|
141
|
-
<div style="margin-top:16px;"> With different Color scheme </div>
|
|
142
|
-
<rapi-pdf id='rapipdf' style="width:730px; height:40px; font-size:18px;"
|
|
143
|
-
spec-url="https://mrin9.github.io/RapiPdf/specs/petstore.json"
|
|
144
|
-
pdf-schema-style="table"
|
|
145
|
-
button-bg="#b44646"
|
|
146
|
-
pdf-primary-color="teal",
|
|
147
|
-
pdf-alternate-color="darkred"
|
|
148
|
-
pdf-title="API Reference"
|
|
149
|
-
> </rapi-pdf>
|
|
150
|
-
|
|
151
|
-
<div style="margin-top:16px;"> With an alternate request/response model represnation style </div>
|
|
152
|
-
<rapi-pdf id='rapipdf' style="width:730px; height:40px; font-size:18px;"
|
|
153
|
-
spec-url="https://mrin9.github.io/RapiPdf/specs/petstore.json"
|
|
154
|
-
pdf-schema-style="table"
|
|
155
|
-
button-bg="#b44646"
|
|
156
|
-
pdf-title="API Reference"
|
|
157
|
-
> </rapi-pdf>
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
</div>
|
|
161
|
-
</div>
|
|
162
|
-
|
|
163
|
-
<!-- Start of API -->
|
|
164
|
-
<div class="api container" id="api">
|
|
165
|
-
<div style="display:flex; flex-direction: column; ">
|
|
166
|
-
<h2> Attributes</h2>
|
|
167
|
-
<div class="table-block">
|
|
168
|
-
<table class="m-table">
|
|
169
|
-
<tr>
|
|
170
|
-
<th class="attr-col">Attribute</th>
|
|
171
|
-
<th style="text-align:left">Description </th>
|
|
172
|
-
<th class="default-col">Default</th>
|
|
173
|
-
</tr>
|
|
174
|
-
|
|
175
|
-
<tr>
|
|
176
|
-
<td class="mono-bold">spec-url </td>
|
|
177
|
-
<td class="gray">url of the OpenAPI spec to view </td>
|
|
178
|
-
<td>(empty)</td>
|
|
179
|
-
</tr>
|
|
180
|
-
|
|
181
|
-
<tr>
|
|
182
|
-
<td class="mono-bold">button-label</td>
|
|
183
|
-
<td class="gray"> Label on the Button</td>
|
|
184
|
-
<td>GENERATE PDF</td>
|
|
185
|
-
</tr>
|
|
186
|
-
|
|
187
|
-
<tr>
|
|
188
|
-
<td class="mono-bold">button-bg</td>
|
|
189
|
-
<td class="gray">Background color for the button</td>
|
|
190
|
-
<td>#0078d7</td>
|
|
191
|
-
</tr>
|
|
192
|
-
|
|
193
|
-
<tr>
|
|
194
|
-
<td class="mono-bold">button-color</td>
|
|
195
|
-
<td class="gray">Text color on the button</td>
|
|
196
|
-
<td>white</td>
|
|
197
|
-
</tr>
|
|
198
|
-
|
|
199
|
-
<tr>
|
|
200
|
-
<td class="mono-bold">input-bg</td>
|
|
201
|
-
<td class="gray">Background color for text input</td>
|
|
202
|
-
<td>white</td>
|
|
203
|
-
</tr>
|
|
204
|
-
|
|
205
|
-
<tr>
|
|
206
|
-
<td class="mono-bold">input-color</td>
|
|
207
|
-
<td class="gray">Text color of the input box</td>
|
|
208
|
-
<td>#333</td>
|
|
209
|
-
</tr>
|
|
210
|
-
|
|
211
|
-
<tr>
|
|
212
|
-
<td class="mono-bold">hide-input</td>
|
|
213
|
-
<td class="gray"> true to hide input Text box </td>
|
|
214
|
-
<td>false</td>
|
|
215
|
-
</tr>
|
|
216
|
-
|
|
217
|
-
<tr>
|
|
218
|
-
<td class="mono-bold">pdf-primary-color</td>
|
|
219
|
-
<td class="gray">Color used for headings of main sections in PDF</td>
|
|
220
|
-
<td>#b44646</td>
|
|
221
|
-
</tr>
|
|
222
|
-
|
|
223
|
-
<tr>
|
|
224
|
-
<td class="mono-bold">pdf-alternate-color</td>
|
|
225
|
-
<td class="gray">Color used for sub headings</td>
|
|
226
|
-
<td>#005b96</td>
|
|
227
|
-
</tr>
|
|
228
|
-
|
|
229
|
-
<tr>
|
|
230
|
-
<td class="mono-bold">pdf-title</td>
|
|
231
|
-
<td class="gray">Title of the generated PDF</td>
|
|
232
|
-
<td>API Reference</td>
|
|
233
|
-
</tr>
|
|
234
|
-
|
|
235
|
-
<tr>
|
|
236
|
-
<td class="mono-bold">pdf-footer-text</td>
|
|
237
|
-
<td class="gray">Text to be printed at the bottom of every page</td>
|
|
238
|
-
<td>(empty)</td>
|
|
239
|
-
</tr>
|
|
240
|
-
|
|
241
|
-
<tr>
|
|
242
|
-
<td class="mono-bold">pdf-schema-style</td>
|
|
243
|
-
<td class="gray">style to display request and response schemas<br/>can be 'table' or 'object'</td>
|
|
244
|
-
<td>object</td>
|
|
245
|
-
</tr>
|
|
246
|
-
|
|
247
|
-
<tr>
|
|
248
|
-
<td class="mono-bold">include-info</td>
|
|
249
|
-
<td class="gray"> true to include info section in the generated PDF</td>
|
|
250
|
-
<td>true</td>
|
|
251
|
-
</tr>
|
|
252
|
-
|
|
253
|
-
<tr>
|
|
254
|
-
<td class="mono-bold">include-toc</td>
|
|
255
|
-
<td class="gray">true to include table-of-contents in the generated PDF</td>
|
|
256
|
-
<td>true</td>
|
|
257
|
-
</tr>
|
|
258
|
-
|
|
259
|
-
<tr>
|
|
260
|
-
<td class="mono-bold">include-security</td>
|
|
261
|
-
<td class="gray">true to include security section in the generated PDF</td>
|
|
262
|
-
<td>true</td>
|
|
263
|
-
</tr>
|
|
264
|
-
|
|
265
|
-
<tr>
|
|
266
|
-
<td class="mono-bold">include-api-details</td>
|
|
267
|
-
<td class="gray">true to include all the API details in the generated PDF</td>
|
|
268
|
-
<td>true</td>
|
|
269
|
-
</tr>
|
|
270
|
-
|
|
271
|
-
<tr>
|
|
272
|
-
<td class="mono-bold">include-api-list</td>
|
|
273
|
-
<td class="gray">true to include list of all the APIs and their summary at the end in the generated PDF </td>
|
|
274
|
-
<td>false</td>
|
|
275
|
-
</tr>
|
|
276
|
-
</table>
|
|
277
|
-
</div>
|
|
278
|
-
|
|
279
|
-
<h2> Methods</h2>
|
|
280
|
-
<div class="table-block">
|
|
281
|
-
<table class="m-table">
|
|
282
|
-
<tr>
|
|
283
|
-
<th > Name</th>
|
|
284
|
-
<th >Description </th>
|
|
285
|
-
</tr>
|
|
286
|
-
<tr>
|
|
287
|
-
<td class="mono-bold">generatePdf(spec)</td>
|
|
288
|
-
<td class="gray">
|
|
289
|
-
to programmatically generate the PDF. <br/>
|
|
290
|
-
Takes a single parameter that can be :
|
|
291
|
-
<ul>
|
|
292
|
-
<li> either a string containing the url of the specs</li>
|
|
293
|
-
<li> or a JSON object representing a valid spec</li>
|
|
294
|
-
</ul>
|
|
295
|
-
<a href="https://github.com/mrin9/RapiPdf/blob/master/docs/examples/example1.html"> Example </a>
|
|
296
|
-
</td>
|
|
297
|
-
</tr>
|
|
298
|
-
<tr>
|
|
299
|
-
<td class="mono-bold">setAttribute(attr-name, value)</td>
|
|
300
|
-
<td class="gray">All HTML elements contains setAttribute() method, You may use this method to programmatically update/change any of its properties</td>
|
|
301
|
-
</tr>
|
|
302
|
-
</table>
|
|
303
|
-
</div>
|
|
304
|
-
|
|
305
|
-
<h2> Localization</h2>
|
|
306
|
-
<div class="mono-bold" style="text-align: center;">create a <template> inside <rapi-pdf> element and provide the translations</div>
|
|
307
|
-
<pre class="shadow code-block"><code class="html" style="border-radius:4px">
|
|
308
|
-
<rapi-pdf spec-url="https://api.apis.guru/v2/specs/bitbucket.org/2.0/swagger.json">
|
|
309
|
-
<template>
|
|
310
|
-
{
|
|
311
|
-
"index" : "INDEX",
|
|
312
|
-
"api" : "API",
|
|
313
|
-
"apiList" : "API List",
|
|
314
|
-
"apiReference" : "API Reference",
|
|
315
|
-
"apiVersion" : "API Version",
|
|
316
|
-
"contact" : "CONTACT",
|
|
317
|
-
"name" : "NAME",
|
|
318
|
-
"email" : "EMAIL",
|
|
319
|
-
"url" : "URL",
|
|
320
|
-
"termsOfService" : "Terms of service",
|
|
321
|
-
"securitySchemes": "SECURITY SCHEMES",
|
|
322
|
-
"type" : "TYPE",
|
|
323
|
-
"description" : "DESCRIPTION",
|
|
324
|
-
"request" : "REQUEST",
|
|
325
|
-
"requestBody" : "REQUEST BODY",
|
|
326
|
-
"response" : "RESPONSE",
|
|
327
|
-
"responseModel" : "RESPONSE MODEL",
|
|
328
|
-
"statusCode" : "STATUS CODE",
|
|
329
|
-
"deprecated" : "DEPRECATED",
|
|
330
|
-
"allowed" : "allowed",
|
|
331
|
-
"pattern" : "pattern",
|
|
332
|
-
"parameters" : "Parameters",
|
|
333
|
-
"method" : "METHOD",
|
|
334
|
-
"securityAndAuthentication" : "Security and Authentication",
|
|
335
|
-
"noRequestParameters" : "No request parameters",
|
|
336
|
-
}
|
|
337
|
-
</template>
|
|
338
|
-
</rapi-pdf>
|
|
339
|
-
</code>
|
|
340
|
-
</pre>
|
|
341
|
-
|
|
342
|
-
</div>
|
|
343
|
-
</div>
|
|
344
|
-
<!-- End of API -->
|
|
345
|
-
|
|
346
|
-
<div id="footer" class="footer container">
|
|
347
|
-
<div class="footer-item"> MIT Licence</div>
|
|
348
|
-
<div class="footer-item"> <a href="https://github.com/mrin9/RapiPdf"> GitHub</a></div>
|
|
349
|
-
<div class="footer-item"> <a href="https://www.npmjs.com/package/rapipdf"> npm</a></div>
|
|
350
|
-
</div>
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
<script>
|
|
354
|
-
|
|
355
|
-
function goToSection(e){
|
|
356
|
-
if (e.target.dataset.action==='git' || e.target.dataset.action==='url' ){
|
|
357
|
-
return;
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
e.preventDefault();
|
|
361
|
-
var gotoEl = document.getElementById(e.target.getAttribute('href').substring(1));
|
|
362
|
-
if (gotoEl){
|
|
363
|
-
gotoEl.scrollIntoView({ block: 'start', behavior: 'smooth' });
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
</script>
|
|
367
|
-
</body>
|
|
368
|
-
|
|
369
|
-
</html>
|
package/index.html
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
|
|
4
|
-
<head>
|
|
5
|
-
<meta name="viewport" content="width=device-width, minimum-scale=1, initial-scale=1, user-scalable=yes">
|
|
6
|
-
<title>RapiPdf</title>
|
|
7
|
-
<style>
|
|
8
|
-
rapi-pdf {
|
|
9
|
-
margin:2px;
|
|
10
|
-
width:600px;
|
|
11
|
-
}
|
|
12
|
-
</style>
|
|
13
|
-
</head>
|
|
14
|
-
|
|
15
|
-
<body>
|
|
16
|
-
<!--
|
|
17
|
-
Some sample spec to try
|
|
18
|
-
http://10.21.83.83:8080/api/swagger.json
|
|
19
|
-
https://api.apis.guru/v2/specs/stripe.com/2019-08-14/swagger.json
|
|
20
|
-
https://api.apis.guru/v2/specs/github.com/v3/swagger.json
|
|
21
|
-
https://api.apis.guru/v2/specs/bitbucket.org/2.0/swagger.json
|
|
22
|
-
https://petstore.swagger.io/v2/swagger.json
|
|
23
|
-
https://assets.zuora.com/zuora-documentation/swagger.yaml <<< Large spec with lot of markdown
|
|
24
|
-
-->
|
|
25
|
-
|
|
26
|
-
<!--
|
|
27
|
-
<rapi-pdf id='rapipdf' spec-url="./examples/specs/test.json" include-info="false" include-security="false" include-toc="false"> </rapi-pdf>
|
|
28
|
-
-->
|
|
29
|
-
<rapi-pdf id='rapipdf' spec-url="./specs/petstore.json" pdf-schema-style="table"> </rapi-pdf>
|
|
30
|
-
<rapi-pdf id='rapipdf' spec-url="./specs/petstore.json" pdf-schema-style="object"> </rapi-pdf>
|
|
31
|
-
<rapi-pdf id='rapipdf' spec-url="./specs/bitbucket.json"> </rapi-pdf>
|
|
32
|
-
<rapi-pdf id='rapipdf' spec-url="./specs/data-types.yaml"> </rapi-pdf>
|
|
33
|
-
<rapi-pdf id='rapipdf' spec-url="./specs/data-types.yaml" include-example="true", button-label="WITH EXAMPLE"> </rapi-pdf>
|
|
34
|
-
<rapi-pdf id='rapipdf' spec-url="./specs/data-types.yaml" hide-input="true"> </rapi-pdf>
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
<button onclick="changeSpec()">Change Spec</button>
|
|
38
|
-
<script type="text/javascript">
|
|
39
|
-
function changeSpec(){
|
|
40
|
-
let el = document.getElementById("rapipdf");
|
|
41
|
-
el.setAttribute('spec-url', 'set new attrib');
|
|
42
|
-
}
|
|
43
|
-
</script>
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
</body>
|
|
47
|
-
|
|
48
|
-
</html>
|
package/logo.png
DELETED
|
Binary file
|
package/src/index.js
DELETED
package/src/markdown.js
DELETED
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
// Inline Markdown
|
|
2
|
-
export function getInlineMarkDownDef(txt) {
|
|
3
|
-
const final = [];
|
|
4
|
-
if (!txt) {
|
|
5
|
-
return [];
|
|
6
|
-
}
|
|
7
|
-
const boldItalicDelimiter = new RegExp('\\*{3}|\\_{3}');
|
|
8
|
-
const boldDelimiter = new RegExp('\\*{2}|\\_{2}');
|
|
9
|
-
const codeDelimiter = new RegExp('`');
|
|
10
|
-
const biParts = txt.split(boldItalicDelimiter);
|
|
11
|
-
biParts.forEach((biVal, i) => {
|
|
12
|
-
if (i % 2 === 0) {
|
|
13
|
-
if (biVal) {
|
|
14
|
-
const bParts = biVal.split(boldDelimiter);
|
|
15
|
-
bParts.forEach((bVal, j) => {
|
|
16
|
-
if (j % 2 === 0) {
|
|
17
|
-
if (bVal) {
|
|
18
|
-
const cParts = bVal.split(codeDelimiter);
|
|
19
|
-
cParts.forEach((cVal, k) => {
|
|
20
|
-
if (k % 2 === 0) {
|
|
21
|
-
if (cVal) {
|
|
22
|
-
final.push({ text: cVal, style: ['small'] });
|
|
23
|
-
}
|
|
24
|
-
} else if (cVal.trim) {
|
|
25
|
-
final.push({ text: cVal, style: ['small', 'mono', 'gray'] });
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
} else if (bVal) {
|
|
30
|
-
final.push({ text: bVal, style: ['small', 'bold'] });
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
} else if (biVal) {
|
|
35
|
-
final.push({ text: biVal, style: ['small', 'bold', 'italics'] });
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
return final;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// Markdown
|
|
42
|
-
export function getMarkDownDef(tokens) {
|
|
43
|
-
const content = [];
|
|
44
|
-
let uList = { ul: [], style: ['topMarginRegular'] };
|
|
45
|
-
let oList = { ol: [], style: ['topMarginRegular'] };
|
|
46
|
-
let listInsert = '';
|
|
47
|
-
|
|
48
|
-
tokens.forEach((v) => {
|
|
49
|
-
if (v.type === 'paragraph') {
|
|
50
|
-
const textArr = getInlineMarkDownDef(v.text);
|
|
51
|
-
content.push({
|
|
52
|
-
text: textArr,
|
|
53
|
-
style: ['topMarginRegular'],
|
|
54
|
-
});
|
|
55
|
-
} else if (v.type === 'heading') {
|
|
56
|
-
let headingStyle = [];
|
|
57
|
-
if (v.depth === 6) {
|
|
58
|
-
headingStyle = ['small', 'b', 'topMarginRegular'];
|
|
59
|
-
} else if (v.depth === 5) {
|
|
60
|
-
headingStyle = ['p', 'b', 'topMarginRegular'];
|
|
61
|
-
} else {
|
|
62
|
-
headingStyle.push(`h${v.depth + 2}`);
|
|
63
|
-
headingStyle.push('topMarginRegular');
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
content.push({
|
|
67
|
-
text: v.text,
|
|
68
|
-
style: headingStyle,
|
|
69
|
-
});
|
|
70
|
-
} else if (v.type === 'space') {
|
|
71
|
-
const headingStyle = [];
|
|
72
|
-
headingStyle.push(`h${v.depth}`);
|
|
73
|
-
content.push({
|
|
74
|
-
text: '\u200B ',
|
|
75
|
-
style: ['small', 'topMarginRegular'],
|
|
76
|
-
});
|
|
77
|
-
} else if (v.type === 'code') {
|
|
78
|
-
const newText = v.text.replace(/ /g, '\u200B ');
|
|
79
|
-
content.push({
|
|
80
|
-
text: newText,
|
|
81
|
-
style: ['small', 'mono', 'gray', 'topMarginRegular'],
|
|
82
|
-
});
|
|
83
|
-
} else if (v.type === 'list_start') {
|
|
84
|
-
listInsert = v.ordered ? 'ol' : 'ul';
|
|
85
|
-
if (v.ordered) {
|
|
86
|
-
listInsert = 'ol';
|
|
87
|
-
oList.start = v.start;
|
|
88
|
-
} else {
|
|
89
|
-
listInsert = 'ul';
|
|
90
|
-
}
|
|
91
|
-
} else if (v.type === 'text') {
|
|
92
|
-
const textArr = getInlineMarkDownDef(v.text);
|
|
93
|
-
if (listInsert === 'ul') {
|
|
94
|
-
uList.ul.push({
|
|
95
|
-
text: textArr,
|
|
96
|
-
});
|
|
97
|
-
} else if (listInsert === 'ol') {
|
|
98
|
-
oList.ol.push({
|
|
99
|
-
text: textArr,
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
} else if (v.type === 'list_end') {
|
|
103
|
-
// Clone the appropriate list and add it to the main content
|
|
104
|
-
if (listInsert === 'ul') {
|
|
105
|
-
content.push(
|
|
106
|
-
{ ...uList },
|
|
107
|
-
);
|
|
108
|
-
} else if (listInsert === 'ol') {
|
|
109
|
-
content.push(
|
|
110
|
-
{ ...oList },
|
|
111
|
-
);
|
|
112
|
-
}
|
|
113
|
-
// reset temp list elements
|
|
114
|
-
uList = { ul: [], style: ['topMarginRegular'] };
|
|
115
|
-
oList = { ol: [], style: ['topMarginRegular'] };
|
|
116
|
-
listInsert = '';
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
return content;
|
|
120
|
-
}
|