Skip to content

Commit 77e2449

Browse files
committed
revert remark experiments
1 parent 462e9f3 commit 77e2449

File tree

3 files changed

+8
-141
lines changed

3 files changed

+8
-141
lines changed

docusaurus.config.js

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@ const { join, resolve } = require('node:path');
22

33
const clsx = require('clsx');
44
const { createApiPageMD, createInfoPageMD } = require('docusaurus-plugin-openapi-docs/lib/markdown');
5-
const { remark } = require('remark');
6-
const mdxRemoveImports = require('remark-mdx-remove-imports');
7-
const stripHtml = require('remark-strip-html');
85

96
const { config } = require('./apify-docs-theme');
107
const { collectSlugs } = require('./tools/utils/collectSlugs');
@@ -365,19 +362,16 @@ module.exports = {
365362
ogImageURL.searchParams.set('title', result.frontMatter.title);
366363
result.frontMatter.image ??= ogImageURL.toString();
367364

368-
const strip = (await import('strip-markdown')).default; // ESM only
369-
// const mdx = (await import('remark-mdx')).default; // ESM only
365+
// Remove import statements and JSX/MDX tags from content
366+
const contentText = result.content
367+
.replace(/import\s+[^;]+;?/g, '') // Remove import statements
368+
.replace(/<[^>]+>/g, '') // Remove all tags (JSX/MDX)
369+
.replace(/\n+/g, ' ') // Replace newlines with space
370+
.replace(/\s+/g, ' ') // Collapse whitespace
371+
.trim();
370372

371-
// Use remark to strip markdown and get plain text
372-
const processed = await remark()
373-
.use(stripHtml)
374-
// .use(mdx)
375-
.use(mdxRemoveImports)
376-
.use(strip)
377-
.process(result.content);
378-
const contentText = String(processed).replace(/\s+/g, ' ').trim();
379-
// Extract the first sentence (ending with . ! or ?) even if it spans multiple lines
380373
const sentenceMatch = contentText.match(/^(.*?[.!?])\s/);
374+
381375
result.frontMatter.description = sentenceMatch ? sentenceMatch[1].trim() : contentText;
382376
}
383377

package-lock.json

Lines changed: 0 additions & 122 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,7 @@
6262
"markdownlint-cli": "^0.45.0",
6363
"patch-package": "^8.0.0",
6464
"path-browserify": "^1.0.1",
65-
"remark": "^15.0.1",
66-
"remark-mdx": "^3.1.1",
67-
"remark-mdx-remove-imports": "^1.6.22",
68-
"remark-strip-html": "^1.0.2",
6965
"rimraf": "^6.0.0",
70-
"strip-markdown": "^6.0.0",
7166
"typescript": "5.9.2",
7267
"typescript-eslint": "^8.38.0"
7368
},

0 commit comments

Comments
 (0)