extract-webpage 1.2.65 → 1.2.67

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "extract-webpage",
3
- "version": "1.2.65",
3
+ "version": "1.2.67",
4
4
  "module": "./dist/extract-webpage.es.js",
5
5
  "description": "Search, extract, cite, and outline the web for a topic with AI Research Agent.",
6
6
  "author": "vtempest <grokthiscontact@gmail.com>",
@@ -72,11 +72,11 @@
72
72
  "dependencies": {
73
73
  "@huggingface/transformers": "^3.8.1",
74
74
  "ai": "^5.0.0",
75
- "chat-agent-toolkit": "^1.2.64",
75
+ "chat-agent-toolkit": "^1.2.66",
76
76
  "chrono-node": "^2.9.0",
77
77
  "drizzle-orm": "^0.45.1",
78
- "extract-pdf": "^0.1.52",
79
- "extract-youtube": "^1.0.51",
78
+ "extract-pdf": "^0.1.54",
79
+ "extract-youtube": "^1.0.52",
80
80
  "html-entities": "^2.6.0",
81
81
  "js-yaml": "^4.1.1",
82
82
  "jsdom": "^28.1.0",
@@ -158,11 +158,24 @@ import "prismjs/components/prism-java";
158
158
  import "prismjs/components/prism-c";
159
159
  import "prismjs/components/prism-cpp";
160
160
 
161
- function highlightCode(code, lang) {
162
- const language = Prism.languages[lang] ? lang : "plaintext";
163
- if (language === "plaintext") return code;
164
- return Prism.highlight(code, Prism.languages[language], language);
165
- }
161
+ // Configure marked once at module load with Prism.js syntax highlighting.
162
+ // marked v17 removed the `highlight` option from setOptions, so highlighting
163
+ // is wired via a custom `code` renderer instead.
164
+ marked.use({
165
+ renderer: {
166
+ code({ text, lang }) {
167
+ const language = lang && Prism.languages[lang] ? lang : null;
168
+ const highlighted = language
169
+ ? Prism.highlight(text, Prism.languages[language], language)
170
+ : text
171
+ .replace(/&/g, "&amp;")
172
+ .replace(/</g, "&lt;")
173
+ .replace(/>/g, "&gt;");
174
+ const cls = language ? ` class="language-${language}"` : "";
175
+ return `<pre><code${cls}>${highlighted}</code></pre>\n`;
176
+ },
177
+ },
178
+ });
166
179
 
167
180
  /**
168
181
  * Converts Markdown text to HTML. It handles the following Markdown elements:
@@ -192,14 +205,6 @@ function highlightCode(code, lang) {
192
205
  export function convertMarkdownToHTML(content, toHtml = true) {
193
206
  if (!toHtml) return convertHTMLToMarkdown(content);
194
207
 
195
-
196
- marked.setOptions({
197
- highlight: function (code, lang) {
198
- return highlightCode(code, lang) ?? code;
199
- },
200
- langPrefix: "language-",
201
- });
202
-
203
208
  return content?.length ? marked.parse(content) : "";
204
209
 
205
210
  var html = contentconvertMarkdownToHTML