Skip to content

Commit f624da6

Browse files
committed
chore: Make linter happy
1 parent 09ab77b commit f624da6

File tree

3 files changed

+11
-14
lines changed

3 files changed

+11
-14
lines changed

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
rapidoc-9.3.4.min.js

README.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,15 @@ Based off the nice official [Discourse mermaid component](https://github.com/dis
66

77
To use it ...
88

9-
* [install it](https://meta.discourse.org/t/install-a-theme-or-theme-component/63682) into your Discourse instance
10-
* in a topic, create a code block and use `apidoc` as language tag and the URL of an OpenAPI specification url as the block's content.
9+
- [install it](https://meta.discourse.org/t/install-a-theme-or-theme-component/63682) into your Discourse instance
10+
- in a topic, create a code block and use `apidoc` as language tag and the URL of an OpenAPI specification url as the block's content.
1111

12-
```
12+
````
1313
```apidoc
1414
https://petstore.swagger.io/v2/swagger.json
15-
```
16-
15+
````
1716

1817
If specification is not publicly accessible, you can attach the specification file to your post and copy the URL after the file has been uploaded.
1918

20-
2119
Here's how it could look like
22-
![rapidoc in discourse](image.png)
20+
![rapidoc in discourse](image.png)

javascripts/discourse/api-initializers/discourse-rapidoc-theme-component.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { apiInitializer } from "discourse/lib/api";
22
import loadScript from "discourse/lib/load-script";
3-
import discourseDebounce from "discourse-common/lib/debounce";
43

54
async function applyRapidoc(element) {
65
const apidocs = element.querySelectorAll("pre[data-code-wrap=apidoc]");
@@ -12,11 +11,10 @@ async function applyRapidoc(element) {
1211
await loadScript(settings.theme_uploads_local.rapidoc_js);
1312

1413
const theme =
15-
getComputedStyle(document.body)
16-
.getPropertyValue("--scheme-type")
17-
.trim() === "dark"
14+
getComputedStyle(document.body).getPropertyValue("--scheme-type").trim() ===
15+
"dark"
1816
? "dark"
19-
: "default"
17+
: "default";
2018

2119
apidocs.forEach((apidoc) => {
2220
if (apidoc.dataset.processed) {
@@ -31,7 +29,7 @@ async function applyRapidoc(element) {
3129
return;
3230
}
3331

34-
const promise = new Promise(resolve => resolve(codeBlock.textContent))
32+
const promise = new Promise((resolve) => resolve(codeBlock.textContent));
3533
promise
3634
.then((spec) => {
3735
apidoc.outerHTML = `
@@ -45,7 +43,7 @@ async function applyRapidoc(element) {
4543
allow-api-list-style-selection="false"
4644
allow-spec-file-download="true"
4745
allow-authentication="true"
48-
theme="${theme==='dark' ? 'dark' : 'light'}"
46+
theme="${theme === "dark" ? "dark" : "light"}"
4947
>
5048
</rapi-doc>
5149
<br/>

0 commit comments

Comments
 (0)