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: add line numbers to code blocks

Martin Adámek2ffba847cb4d
diff --git a/docs/guides/request_storage.mdx b/docs/guides/request_storage.mdx
index 2993b8371..64c2efeb9 100644
--- a/docs/guides/request_storage.mdx
+++ b/docs/guides/request_storage.mdx
@@ -29,7 +29,7 @@ In Crawlee, the request queue is represented by the <ApiLink to="core/class/Requ
The request queue is managed by <ApiLink to="memory-storage/class/MemoryStorage">`MemoryStorage`</ApiLink> class and its data is stored in memory, while also being off-loaded to the local directory specified by the `CRAWLEE_STORAGE_DIR` environment variable as follows:
-```
+```text
{CRAWLEE_STORAGE_DIR}/request_queues/{QUEUE_ID}/entries.json
```
diff --git a/website/src/css/custom.css b/website/src/css/custom.css
index d5c62dd4f..532776074 100644
--- a/website/src/css/custom.css
+++ b/website/src/css/custom.css
@@ -47,6 +47,7 @@ html[data-theme='dark'] {
--ifm-link-color: hsl(214, 84%, 50%);
--ifm-link-hover-color: hsl(214, 84%, 65%);
--ifm-link-hover-decoration: none;
+ --ifm-pre-padding: 1.6rem;
--ifm-footer-background-color: #272c3d;
--ifm-footer-title-color: #f2f3fb;
@@ -446,3 +447,32 @@ html.plugin-typedoc-api .theme-doc-sidebar-menu > li:nth-child(6)::before {
html[data-theme='dark'] .runnable-code-block svg .apify-logo {
fill: #fff;
}
+
+/*
+ * Reset the line-number counter for each .prism-code scope
+ */
+.prism-code {
+ counter-reset: line-number;
+}
+
+/*
+ * Notice the chained .language-ts class name to .prism-code
+ * You can chain more languages in order to add line numbers
+ */
+.prism-code.language-ts .token-line::before,
+.prism-code.language-typescript .token-line::before,
+.prism-code.language-javascript .token-line::before,
+.prism-code.language-json .token-line::before,
+.prism-code.language-json5 .token-line::before,
+.prism-code.language-XML .token-line::before,
+.prism-code.language-js .token-line::before {
+ counter-increment: line-number;
+ content: counter(line-number);
+ margin-right: calc(var(--ifm-pre-padding) * 0.8);
+ text-align: right;
+ min-width: 1.5rem;
+ display: inline-block;
+ opacity: .3;
+ position: sticky;
+ left: var(--ifm-pre-padding);
+}
diff --git a/website/versioned_docs/version-3.8/guides/request_storage.mdx b/website/versioned_docs/version-3.8/guides/request_storage.mdx
index 2993b8371..64c2efeb9 100644
--- a/website/versioned_docs/version-3.8/guides/request_storage.mdx
+++ b/website/versioned_docs/version-3.8/guides/request_storage.mdx
@@ -29,7 +29,7 @@ In Crawlee, the request queue is represented by the <ApiLink to="core/class/Requ
The request queue is managed by <ApiLink to="memory-storage/class/MemoryStorage">`MemoryStorage`</ApiLink> class and its data is stored in memory, while also being off-loaded to the local directory specified by the `CRAWLEE_STORAGE_DIR` environment variable as follows:
-```
+```text
{CRAWLEE_STORAGE_DIR}/request_queues/{QUEUE_ID}/entries.json
```