Skip to content

Crawlee—A web scraping and browser automation library for Node.js to build reliable crawlers. In JavaScript and TypeScript. Extract data for AI, LLMs, RAG, or GPTs. Download HTML, PDF, JPG, PNG, and other files from websites. Works with Puppeteer, Playwright, Cheerio, JSDOM, and raw HTTP. Both headful and headless mode. With proxy rotation.

Docs - improved formatting for the Return descriptions and other smal… (#629)

Jan Čurn9348391f47f2
diff --git a/website/tools/build_docs.js b/website/tools/build_docs.js
index 7b5e3f58e..38d8a648d 100644
--- a/website/tools/build_docs.js
+++ b/website/tools/build_docs.js
@@ -227,4 +227,4 @@ const main = async () => {
await Promise.all([...cPs, ...nPs, ...tPs]);
};
-main().then(() => console.log('All docs built succesfully.'));
+main().then(() => console.log('All docs built successfully.'));
diff --git a/website/tools/helpers.js b/website/tools/helpers.js
index 600cb4655..24d7a2e61 100644
--- a/website/tools/helpers.js
+++ b/website/tools/helpers.js
@@ -32,3 +32,23 @@ exports.class = (options) => {
}
return result ? options.fn(result) : 'ERROR, Cannot find class.';
};
+
+exports.params = function params(options) {
+ if (this.params) {
+ const list = this.params.map((param) => {
+ const nameSplit = param.name.split('.');
+ let name = nameSplit[nameSplit.length - 1];
+ if (param.variable) name = `...${name}`;
+ if (param.optional) name = `[${name}]`;
+ return {
+ indent: ' '.repeat(nameSplit.length - 1),
+ name,
+ type: param.type,
+ optional: param.optional,
+ defaultvalue: param.defaultvalue,
+ description: param.description,
+ };
+ });
+ return options.fn(list);
+ }
+};
diff --git a/website/tools/partials/params-list.hbs b/website/tools/partials/params-list.hbs
index 8b2492eab..dcf0016a0 100644
--- a/website/tools/partials/params-list.hbs
+++ b/website/tools/partials/params-list.hbs
@@ -1,5 +1,5 @@
{{#if params}}
-{{#params}}**Params**
+{{#params}}**Parameters**:
{{#each this~}}
{{indent}}- **`{{name}}`**:{{#if type}} {{>linked-type-list types=type.names delimiter=" | " }}{{/if}}{{#unless (equal defaultvalue undefined)}} {{>defaultvalue equals=true ~}}{{/unless}}{{#if description}} - {{{inlineLinks description}}}{{/if}}
diff --git a/website/tools/partials/returns.hbs b/website/tools/partials/returns.hbs
index 8fb55516c..505734d59 100644
--- a/website/tools/partials/returns.hbs
+++ b/website/tools/partials/returns.hbs
@@ -1,5 +1,7 @@
{{#if returns}}
-**Returns**: {{#each returns~}}
+**Returns**:
+
+{{#each returns~}}
{{#if type~}}
{{#if type.names}}{{>linked-type-list types=type.names delimiter=" \| " ~}}{{/if}}
{{~#if description}} - {{{inlineLinks description}}}{{/if~}}